예제 #1
0
 public function index()
 {
     CssJs::getInst()->c_js('social/scheduled', 'index');
     $user_posts = Social_post::inst()->get_user_scheduled_posts($this->c_user->id, $this->profile->id, 1, self::POSTS_COUNT, 'all');
     $this->template->set('posts', $user_posts);
     $this->template->render();
 }
예제 #2
0
 public function index()
 {
     $group = $this->config->item('default_group', 'ion_auth');
     $limit = $this->config->config['users_on_page'];
     $page = !empty($_GET['page']) ? $_GET['page'] : 1;
     if ($page != 1) {
         $offset = $limit * ($page - 1);
     } else {
         $offset = '';
     }
     $searchText = Arr::get($_GET, 'search', '');
     $filter = Arr::get($_GET, 'filter', '');
     if ($searchText || $filter !== '') {
         $users = $this->search();
         JsSettings::instance()->add(array('search' => $searchText, 'filter' => $filter, 'group' => $group));
     } else {
         $users = $this->ion_auth->getUsersByGroup($group);
         if ($users) {
             $users->get($limit, $offset);
         }
     }
     CssJs::getInst()->add_js('controller/admin/manage_users.js', 'footer')->add_js(array('controller/admin/users_pagination.js', 'controller/admin/autocomplete.js'))->add_js('libs/test.js', null, 'footer');
     $this->template->set('users', $users);
     $this->template->set('group', $group);
     $this->template->set('limit', $limit);
     $this->template->set('page', $page);
     $this->template->set('c_user', $this->c_user);
     $this->template->render();
 }
예제 #3
0
 public function index()
 {
     $data = [];
     $days = Cron_day::inst()->get()->all_to_array(['day']);
     foreach ($days as $day) {
         $data[$day['day']] = [];
     }
     $cron_posts = Social_post_cron::inst()->where(['profile_id' => $this->profile->id, 'user_id' => $this->c_user->id])->get();
     $utc_timezone = new DateTimeZone('UTC');
     /** @var Social_post_cron $cron_post */
     foreach ($cron_posts as $cron_post) {
         $cron_days = $cron_post->cron_day->get();
         foreach ($cron_days as $cron_day) {
             $time_in_utc = $cron_post->getTimeInUtc();
             foreach ($time_in_utc as $time) {
                 $timezoned_time = new DateTime($time, $utc_timezone);
                 $timezoned_time->setTimezone(new DateTimeZone($cron_post->timezone));
                 if (!is_array($data[$cron_day->day][$timezoned_time->format(lang('time_without_minutes_format'))])) {
                     $data[$cron_day->day][$timezoned_time->format(lang('time_without_minutes_format'))] = [];
                 }
                 array_push($data[$cron_day->day][$timezoned_time->format(lang('time_without_minutes_format'))], ['post' => $cron_post, 'post_time' => $timezoned_time->format(lang('time_format'))]);
             }
             ksort($data[$cron_day->day]);
         }
     }
     CssJs::getInst()->c_js('social/cron_post', 'index');
     $this->template->set('data', $data);
     $this->template->render();
 }
예제 #4
0
 public function index()
 {
     if (!empty($_POST)) {
         $this->save_links();
     }
     $directories = DM_Directory::get_all_sorted();
     $raw_dir_user = Directory_User::get_by_user_and_profile($this->c_user->id, $this->profile->id);
     $user_directories = $raw_dir_user->to_dir_array();
     $is_notified = $raw_dir_user->isNotified();
     CssJs::getInst()->c_js();
     JsSettings::instance()->add(array('autocomplete_url' => site_url('settings/directories/google_autocomplete')));
     $parsers = array();
     foreach ($directories as $_dir) {
         try {
             $parsers[$_dir->id] = Directory_Parser::factory($_dir->type);
         } catch (Exception $e) {
             $parsers[$_dir->id] = new stdClass();
         }
     }
     $receive_emails = $this->getAAC()->isGrantedPlan('email_notifications');
     $this->template->set('is_notified', $is_notified);
     $this->template->set('parsers', $parsers);
     $this->template->set('directories', $directories);
     $this->template->set('user_directories', $user_directories);
     $this->template->set('receive_emails', $receive_emails);
     $this->template->render();
 }
예제 #5
0
 /**
  * Used to show Social Media Settings Page
  * site_url/settings/socialmedia
  * Show Social-connect buttons
  *
  * @access public
  * @return void
  */
 public function index()
 {
     CssJs::getInst()->c_js('settings/profiles', 'index');
     $groups = $this->c_user->social_group->get();
     $this->template->set('groups', $groups);
     $this->template->render();
 }
예제 #6
0
 /**
  * Rss settings page
  */
 public function index()
 {
     $rss_custom = Rss_feed::inst()->user_custom_feeds($this->c_user->id, $this->profile->id);
     JsSettings::instance()->add(array('rss' => array('custom_action' => $this->session->flashdata('rss_custom_action'), 'remove_url' => site_url('settings/rss/remove_rss_custom'))));
     CssJs::getInst()->c_js();
     $this->template->set('rss_custom', $rss_custom);
     $this->template->render();
 }
예제 #7
0
 /**
  * Render Reports Page
  *
  * @access public
  * @return void
  */
 public function index()
 {
     JsSettings::instance()->add(array('reports' => array('dates' => $this->dates, 'date_format' => $this->date_format)));
     CssJs::getInst()->add_js(array('libs/highcharts/highcharts.js'));
     CssJs::getInst()->c_js('social/reports', 'index');
     CssJs::getInst()->add_js('www.google.com/jsapi', 'external', 'header');
     $this->template->render();
 }
예제 #8
0
 public function __construct()
 {
     parent::__construct();
     CssJs::getInst()->add_js(array('libs/jquery.sortable.js', 'controller/admin/transactions.js', 'controller/admin/transactions_pagination.js'));
     $this->load->config('transactions');
     $this->lang->load('transactions', $this->language);
     JsSettings::instance()->add(['i18n' => $this->lang->load('transactions', $this->language)]);
 }
예제 #9
0
 public function social($social = 'facebook')
 {
     $this->load->helper('clicable_links');
     //$social = ($social === 'twitter') ? $social : 'facebook';
     $has_access = Access_token::inst()->get_by_type($social, $this->c_user->id)->exists();
     $this->template->set('has_access', $has_access);
     if ($has_access) {
         $page = max(1, intval(Arr::get($_GET, 'page', 1)));
         $per_page = 10;
         $keyword = Arr::get($_GET, 'keyword', 0);
         $keyword_query_str = $keyword ? '&keyword=' . $keyword : '';
         $keywords = Mention_keyword::inst()->dropdown($this->c_user->id);
         $use_dates = Arr::get($_GET, 'from') || Arr::get($_GET, 'to');
         $from = date('M j, Y', strtotime(Arr::get($_GET, 'from', 'yesterday')));
         $to = date('M j, Y', strtotime(Arr::get($_GET, 'to', 'today')));
         list($from, $to) = $this->getDatesFromRequest();
         $formatedFrom = $from->format($this->dateFormat);
         $formatedTo = $to->format($this->dateFormat);
         $dates = array('from' => $formatedFrom, 'to' => $formatedTo);
         $dates_query_str = '&from=' . urlencode($formatedFrom) . '&to=' . urlencode($formatedTo);
         $this->template->set('dates', $dates);
         $this->template->set('use_dates', $use_dates);
         $mentions = Mention::inst()->by_social($this->c_user->id, $social);
         if ($keyword) {
             $mentions->where('mention_keyword_id', $keyword);
         }
         $mentions->where('created_at >=', $from->getTimestamp())->where('created_at <=', $to->getTimestamp());
         $mentions->get_paged($page, $per_page);
         $keywords_for_highlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, intval($keyword));
         JsSettings::instance()->add(array('non_ajax_pagination' => true, 'keywords' => $keywords_for_highlight, 'keyword_query_str' => $keyword_query_str, 'keyword_query_id' => $keyword, 'dates_query_str' => $dates_query_str, 'dates' => $dates));
         CssJs::getInst()->c_js('social/activity', $social)->c_js();
         if ($social === 'facebook') {
             $profile_photo = User_additional::inst()->get_value($this->c_user->id, 'facebook_profile_photo');
             if (is_null($profile_photo)) {
                 try {
                     $this->load->library('Socializer/socializer');
                     $facebook = Socializer::factory('Facebook', $this->c_user->id);
                     $profile_picture = $facebook->get_profile_picture();
                     if (isset($profile_picture['picture']['data']['url'])) {
                         $profile_photo = $profile_picture['picture']['data']['url'];
                     }
                     if ($profile_photo) {
                         User_additional::inst()->set_value($this->c_user->id, 'facebook_profile_photo', $profile_photo);
                     }
                 } catch (Exception $e) {
                     $this->template->set('socializer_error', $e->getMessage());
                 }
             }
             $this->template->set('profile_photo', $profile_photo);
         }
         $this->template->set('keyword', $keyword);
         $this->template->set('keyword_query_str', $keyword_query_str);
         $this->template->set('keywords', $keywords);
         $this->template->set('mentions', $mentions);
     }
     $this->template->set('social', $social);
     $this->template->render();
 }
예제 #10
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('manage_users');
     CssJs::getInst()->add_js('controller/admin/manage_users.js', 'footer')->add_js(array('controller/admin/users_pagination.js', 'controller/admin/autocomplete.js', 'controller/admin/manage_admins.js'))->add_js('libs/test.js', null, 'footer');
     $this->lang->load('admin_global_users', $this->language);
     $this->lang->load('manage_admins', $this->language);
     JsSettings::instance()->add(['i18n' => $this->lang->load('manage_admins', $this->language)]);
 }
예제 #11
0
 /**
  * Display subscriptions of user
  */
 public function index()
 {
     $subscription = new Subscription();
     $subscriptions = $subscription->getUserSubscriptions($this->c_user->id, true);
     CssJs::getInst()->add_css('dev/admin.css')->c_js('settings/subscriptions', 'index');
     $this->template->set('subscriptions', $subscriptions);
     $this->template->set('active_subscription', $this->c_user->getLastSubscription());
     $this->template->render();
 }
예제 #12
0
 /**
  * Default page - Website traffic with overall statistics and graph
  */
 public function index()
 {
     $this->_force_configure();
     JsSettings::instance()->add(array('analytics' => array('dates' => $this->dates, 'date_format' => $this->date_format, 'default_traffic_type' => 'web', 'traffic_types' => $this->ga_use->queries_types(), 'request_url' => site_url('traffic/data'))));
     CssJs::getInst()->add_js('www.google.com/jsapi', 'external', 'footer');
     CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js', 'libs/highcharts/highcharts.js'));
     CssJs::getInst()->c_js();
     $this->template->set('dates', $this->dates);
     $this->template->render();
 }
예제 #13
0
 public function index()
 {
     if (!$this->piwik) {
         redirect("settings/piwik/config");
     }
     CssJs::getInst()->add_js(array('controller/settings/piwik/index.js'));
     $sites = $this->piwik->getAllSites();
     $this->template->set('sites', $sites);
     $this->template->set('site_id', $this->c_user->ifUserHasConfigValue('piwik_site_id'));
     $this->template->render();
 }
예제 #14
0
 /**
  * Default rank page
  */
 public function index()
 {
     $this->keywords = Keyword::inst()->with_rank($this->c_user->id, $this->profile->id);
     $this->_force_configure();
     $available_periods_names = count($this->available_periods_names) > 1 ? $this->available_periods_names : array();
     JsSettings::instance()->add(array('google_rank' => array('filter_url' => site_url('rank/filter'))));
     CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js'))->c_js();
     $this->template->set('available_periods_names', $available_periods_names);
     $this->template->set('keywords', $this->keywords);
     $this->template->render();
 }
예제 #15
0
 public function index()
 {
     if ($this->c_user->isTrialPlanEnds()) {
         $this->addFlash(lang('subscription_ends_error', [site_url('subscript/plans')]), 'error');
     }
     // UNCOMMENT TO USE
     // get average google rank for all keywords for chart in range
     $keyword_rank = Keyword::average_for_range($this->c_user->id, '-30 days', 'today');
     // average result for all the range
     $keywords_trending = Keyword::average_for_range($this->c_user->id, '-30 days', 'today', FALSE);
     // average for each day in range
     // analytics data
     $google_access_token = Access_token::getByTypeAndUserId('googlea', $this->c_user->id);
     list($ga_visits_chart, $ga_visits_count) = $google_access_token->google_analytics_dashboard_visits();
     $review = new Review();
     $last_reviews_count = $review->last_period_count($this->c_user->id, $this->profile->id);
     $review->clear();
     $social_values = Social_value::inst();
     $social_values->set_values($this->c_user->id, $this->profile->id, array('from' => date('Y-m-d', strtotime('-30 days')), 'to' => date('Y-m-d', time())));
     $all_socials_data = $social_values->get_data();
     $monthly_trending = array('reviews' => $review->last_month_trending($this->c_user->id, $this->profile->id), 'traffic' => $ga_visits_chart, 'keywords' => $keywords_trending, 'twitter_followers' => $all_socials_data['twitter'], 'facebook_likes' => $all_socials_data['facebook']);
     $keywordsForHighlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, 0);
     CssJs::getInst()->add_js('www.google.com/jsapi', 'external', 'footer');
     CssJs::getInst()->add_js(array('libs/lodash.compat.js', 'libs/highcharts/highcharts.js'))->c_js();
     $opportunities = $this->getOpportunities();
     if (!empty($opportunities['web_radar'])) {
         CssJs::getInst()->add_js('controller/webradar/index.js');
     }
     JsSettings::instance()->add(array('monthly_trending' => $monthly_trending, 'dashboard' => true, 'keywords' => $keywordsForHighlight, 'opportunities' => $opportunities));
     $summary = array('reviews' => (int) $last_reviews_count, 'fb_likes' => (int) $all_socials_data['likes_count'], 'twiter_followers' => (int) $all_socials_data['followers_count'], 'web_traffic' => (int) $ga_visits_count, 'google_rank' => (int) round($keyword_rank, 3));
     $this->isSupportScheduledPosts = $this->getAAC()->isGrantedPlan('scheduled_posts');
     $this->load->helper('my_url_helper');
     $this->template->set('isSupportScheduledPosts', $this->isSupportScheduledPosts);
     $this->template->set('socials', Social_post::getActiveSocials($this->profile->id));
     $this->is_user_set_timezone = User_timezone::is_user_set_timezone($this->c_user->id);
     JsSettings::instance()->add(array('twitterLimits' => array('maxLength' => 140, 'midLength' => 117, 'lowLength' => 94), 'twitterLimitsText' => lang('twitter_error'), 'linkedinLimits' => array('maxLength' => 400), 'linkedinLimitsText' => lang('linkedin_error')));
     CssJs::getInst()->add_css(array('custom/pick-a-color-1.css'));
     CssJs::getInst()->add_js(array('libs/jq.file-uploader/jquery.iframe-transport.js', 'libs/jq.file-uploader/jquery.fileupload.js', 'libs/fabric/fabric.min.js', 'libs/fabric/StackBlur.js', 'libs/color/tinycolor-0.9.15.min.js', 'libs/color/pick-a-color-1.2.3.min.js'));
     CssJs::getInst()->c_js('social/create', 'post_update');
     CssJs::getInst()->c_js('social/create', 'post_cron');
     CssJs::getInst()->c_js('social/create', 'post_attachment');
     CssJs::getInst()->c_js('social/create', 'social_limiter');
     CssJs::getInst()->c_js('social/create', 'schedule_block');
     CssJs::getInst()->c_js('social/create', 'bulk_upload');
     $this->template->set('is_user_set_timezone', User_timezone::is_user_set_timezone($this->c_user->id));
     $user_posts = Social_post::inst()->get_user_scheduled_posts($this->c_user->id, $this->profile->id, 1, 3, 'all');
     $this->template->set('posts', $user_posts);
     $this->load->helper('Image_designer_helper');
     $this->template->set('imageDesignerImages', Image_designer::getImages());
     $this->template->set('summary', $summary);
     $this->template->set('opportunities', $opportunities);
     $this->template->set('need_welcome_notification', User_notification::needShowNotification($this->c_user->id, User_notification::WELCOME));
     $this->template->render();
 }
예제 #16
0
 public function index()
 {
     $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean');
     $this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean');
     if ($this->input->post()) {
         $config = $this->config->config;
         if (!$config['change_settings']) {
             $this->addFlash(lang('demo_error'));
         } else {
             $data = array('first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'));
             if ($this->input->post('old_password') || $this->c_user->password == 0) {
                 $old_password = $this->input->post('old_password');
                 $ion_model = new Ion_auth_model();
                 if ($this->c_user->password == 0) {
                     $valid_old = true;
                 } else {
                     $valid_old = $ion_model->hash_password_db($this->c_user->id, $old_password);
                 }
                 $password_min = $this->config->item('min_password_length', 'ion_auth');
                 $password_max = $this->config->item('max_password_length', 'ion_auth');
                 $this->form_validation->set_rules('new_password', lang('new_password'), 'required|min_length[' . $password_min . ']|max_length[' . $password_max . ']|matches[confirm_password]');
                 $this->form_validation->set_rules('confirm_password', lang('confirm_new_password'), 'required');
                 if ($valid_old) {
                     $data['password'] = $this->input->post('new_password');
                 } else {
                     $this->form_validation->create_error(lang('invalid_old_password_error'));
                 }
             }
             if ($this->form_validation->run() === true) {
                 $update = $this->ion_auth->update($this->c_user->id, $data);
                 if ($update) {
                     $this->addFlash(lang('personal_settings_updated'), 'success');
                     redirect('settings/personal');
                 } else {
                     $this->addFlash($this->ion_auth->errors());
                 }
             } else {
                 if (validation_errors()) {
                     $this->addFlash(validation_errors());
                 }
             }
         }
     }
     $this->load->config('timezones');
     $timezones = $this->config->item('timezones');
     $this->template->set('timezones', $timezones);
     $current_timezone = User_timezone::get_user_timezone($this->c_user->id, true);
     $this->template->set('current_timezone', $current_timezone);
     $this->template->set('email', $this->c_user->email);
     $this->template->set('first_name', $this->form_validation->set_value('first_name', $this->c_user->first_name));
     $this->template->set('last_name', $this->form_validation->set_value('last_name', $this->c_user->last_name));
     CssJs::getInst()->add_js(array('controller/settings/index.js', 'controller/settings/personal/index.js'));
     $this->template->render();
 }
예제 #17
0
 public function index()
 {
     if (!$this->piwik) {
         $this->addFlash(lang('please_select_site'));
         redirect('settings/piwik');
     }
     JsSettings::instance()->add(array('analytics' => array('dates' => $this->dates, 'date_format' => $this->date_format, 'request_url' => site_url('piwik/data'))));
     CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js', 'libs/highcharts/highcharts.js'));
     CssJs::getInst()->c_js();
     $this->template->set('dates', $this->dates);
     $this->template->render();
 }
예제 #18
0
 public function index($social = null)
 {
     $this->load->helper('clicable_links');
     /* @var Core\Service\Radar\Radar $radar */
     $radar = $this->get('core.radar');
     $this->config->load('web_radar');
     $limit = $this->config->config['mentions_limit'];
     $offset = Arr::get($_GET, 'offset', 0);
     $radar->addFilterParams(array('user_id' => $this->c_user->id, 'profile_id' => $this->profile->id))->setLimit($limit)->setOffset($offset);
     $socials = $radar->getSocials();
     if ($social && !in_array($social, $socials)) {
         $social = null;
     }
     $this->activeSocials = Access_token::inst()->get_user_socials($this->c_user->id, $this->profile->id);
     list($from, $to) = $this->getDatesFromRequest();
     if ($keyword = Arr::get($_GET, 'keyword', 0)) {
         $radar->addFilterParams(array('mention_keyword_id' => $keyword));
     }
     if ($social) {
         $radar->addFilterParams(array('social' => $social));
     }
     if ($from) {
         $radar->addFilterParams(array('from' => $from->getTimestamp()));
     }
     if ($to) {
         $radar->addFilterParams(array('to' => $to->getTimestamp()));
     }
     $mentions = $radar->getRadarMentions();
     $feed = $this->getHtmlData($mentions);
     if ($this->template->is_ajax()) {
         echo json_encode(array('html' => $feed));
         exit;
     }
     $keywordQueryStr = $keyword ? '&keyword=' . $keyword : '';
     $formatedFrom = $from->format($this->dateFormat);
     $formatedTo = $to->format($this->dateFormat);
     $dates = array('from' => $formatedFrom, 'to' => $formatedTo);
     $keywords = Mention_keyword::inst()->dropdown($this->c_user->id, $this->profile->id);
     $keywordsForHighlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, intval($keyword));
     CssJs::getInst()->add_js(array('controller/webradar/index.js', 'libs/jsUtils.min.js'));
     JsSettings::instance()->add(array('non_ajax_pagination' => true, 'keywords' => $keywordsForHighlight, 'keyword_query_id' => $keyword, 'keyword_query_str' => $keywordQueryStr, 'social' => $social, 'socials' => $socials, 'dates' => $dates));
     $this->template->set('dates', $dates);
     $this->template->set('dateRange', $diff = $from->diff($to)->format("%a"));
     $this->template->set('keyword', $keyword);
     $this->template->set('keywordQueryStr', $keywordQueryStr);
     $this->template->set('keywords', $keywords);
     $this->template->set('socials', $socials);
     $this->template->set('feed', $feed);
     $socialName = $social ? ucfirst($social) : lang('all_mentions');
     $this->template->set('social', $socialName);
     $this->template->current_view = 'social/webradar/index';
     $this->template->render();
 }
예제 #19
0
 /**
  * Display subscriptions of user
  */
 public function index()
 {
     CssJs::getInst()->add_js('controller/settings/collaboration.js');
     $users = $this->c_user;
     $managerId = $this->c_user->id;
     $group = $this->config->item('collaborator_group', 'ion_auth');
     $users->getManagerUsers();
     $this->template->set('users', $users);
     $this->template->set('c_user', $this->c_user);
     $this->template->set('group', $group);
     $this->template->set('managerAccount', $managerId);
     $this->template->render();
 }
 /**
  * Form with mentions keywords list
  */
 public function index()
 {
     $keywords = User_search_keyword::inst()->get_user_keywords($this->c_user->id, $this->profile->id);
     $new_keywords = array();
     $errors = array();
     $saved_ids = array(0);
     // '0' to prevent datamapper error caused by empty array
     $delete = true;
     if ($post = $this->input->post()) {
         unset($post['submit']);
         $grouped = Arr::collect($post);
         foreach ($grouped as $id => $data) {
             if (strpos($id, 'new_') === 0) {
                 $keyword = User_search_keyword::inst()->fill_from_array($data, $this->c_user->id, $this->profile->id);
                 $new_keywords[$id] = $keyword;
             } else {
                 $keyword = User_search_keyword::inst()->fill_from_array($data, $this->c_user->id, $this->profile->id, $id);
                 if ($keyword->id !== $id) {
                     $new_keywords[$id] = $keyword;
                 }
             }
             if ($keyword->save()) {
                 $saved_ids[] = $keyword->id;
             } else {
                 $errors[$id] = $keyword->error->string;
             }
         }
         if (empty($errors)) {
             if ($delete) {
                 User_search_keyword::inst()->set_deleted($this->c_user->id, $this->profile->id, $saved_ids);
             }
             $this->addFlash(lang('keywords_saved_success'), 'success');
             redirect('settings/user_search_keywords');
         } else {
             $this->addFlash(implode('<br>', Arr::map('strip_tags', $errors)));
         }
     }
     CssJs::getInst()->c_js('settings/user_search_keywords', 'index');
     $configs = Available_config::getByKeysAsArray(array('auto_follow_users_by_search', 'max_daily_auto_follow_users_by_search'), $this->c_user, $this->profile->id);
     $outp_keywords = array();
     foreach ($keywords as $keyword) {
         $outp_keywords[$keyword->id] = $keyword;
     }
     $outp_keywords = array_merge($outp_keywords, $new_keywords);
     $this->template->set('keywords', $outp_keywords);
     $this->template->set('errors', $errors);
     $this->template->set('configs', $configs);
     $this->template->render();
 }
예제 #21
0
 public function index()
 {
     $this->load->helper('clicable_links');
     $radar = $this->get('core.radar');
     $this->config->load('web_radar');
     $limit = $this->config->config['mentions_limit'];
     $offset = Arr::get($_GET, 'offset', 0);
     $radar->addFilterParams(array('user_id' => $this->c_user->id))->setLimit($limit)->setOffset($offset);
     $socials = $radar->getSocials();
     $this->activeSocials = Access_token::inst()->get_user_socials($this->c_user->id, $this->profile->id);
     //$this->fbUserImageUrl = $radar->getFBUserImage($this->c_user->id);
     $from = date($this->dateFormat, strtotime(Arr::get($_GET, 'from', 'yesterday')));
     $to = date($this->dateFormat, strtotime(Arr::get($_GET, 'to', 'today')));
     list($from, $to) = $this->getDatesFromRequest();
     if ($keyword = Arr::get($_GET, 'keyword', 0)) {
         $radar->addFilterParams(array('mention_keyword_id' => $keyword));
     }
     if ($social = Arr::get($_GET, 'social', 0)) {
         $radar->addFilterParams(array('social' => $social));
     }
     if ($from) {
         $radar->addFilterParams(array('from' => $from->getTimestamp()));
     }
     if ($to) {
         $radar->addFilterParams(array('to' => $to->getTimestamp()));
     }
     $mentions = $radar->getRadarInfluencers($this->c_user->id);
     $feed = $this->getHtmlData($mentions);
     if ($this->template->is_ajax()) {
         echo json_encode(array('html' => $feed));
         exit;
     }
     $keywordQueryStr = $keyword ? '&keyword=' . $keyword : '';
     $formatedFrom = $from->format($this->dateFormat);
     $formatedTo = $to->format($this->dateFormat);
     $dates = array('from' => $formatedFrom, 'to' => $formatedTo);
     $keywords = Mention_keyword::inst()->dropdown($this->c_user->id, $this->profile->id);
     $keywordsForHighlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, intval($keyword));
     CssJs::getInst()->c_js();
     JsSettings::instance()->add(array('non_ajax_pagination' => true, 'keywords' => $keywordsForHighlight, 'keyword_query_id' => $keyword, 'keyword_query_str' => $keywordQueryStr, 'socials' => $socials, 'dates' => $dates));
     $this->template->set('dates', $dates);
     $this->template->set('keyword', $keyword);
     $this->template->set('keywordQueryStr', $keywordQueryStr);
     $this->template->set('keywords', $keywords);
     $this->template->set('socials', $socials);
     $this->template->set('feed', $feed);
     $this->template->render();
 }
예제 #22
0
 public function __construct()
 {
     parent::__construct();
     $this->lang->load('crm', $this->language);
     JsSettings::instance()->add(['i18n' => $this->lang->load('crm', $this->language)]);
     $this->load->config('site_config', TRUE);
     $this->crmManager = $this->get('core.crm.manager');
     $this->activeSocials = Access_token::inst()->get_crm_user_socials($this->c_user->id, $this->profile->id);
     $hasDirectories = Crm_directory::inst()->hasDirectories($this->c_user->id, $this->profile->id);
     $this->template->set('hasDirectories', $hasDirectories);
     $hasRequested = Crm_directory::inst()->hasRequested($this->c_user->id, $this->profile->id);
     $this->template->set('hasRequested', $hasRequested);
     //CssJs::getInst()->add_css('crm.css');
     CssJs::getInst()->add_js('controller/crm/index.js');
     $this->load->helper('clicable_links');
 }
예제 #23
0
 public function all($directory_id)
 {
     if (empty($directory_id) || !is_numeric($directory_id)) {
         show_404();
     }
     $directory_user = Directory_User::get_user_dir($this->c_user->id, $directory_id, $this->profile->id);
     if (!$directory_user->exists()) {
         return $this->link_to_config();
     }
     JsSettings::instance()->add(array('stars' => (int) $directory_user->directory->stars));
     CssJs::getInst()->add_js(array('libs/raty/jquery.raty.min.js', 'libs/lodash.compat.js'))->c_js();
     $reviews = new Review();
     $reviews->latest_reviews_paged($directory_id, $this->c_user->id, (int) $this->input->get('page'));
     sMenu::getInst()->set_pal('reviews/' . $directory_id);
     $this->template->set('reviews', $reviews);
     $this->template->set('directory_id', $directory_id);
     $this->template->set('type', $directory_user->directory->type);
     $this->template->render();
 }
예제 #24
0
 /**
  * Form with keywords list
  */
 public function index()
 {
     $this->load->config('site_config', TRUE);
     $keywords_config = $this->config->item('keywords', 'site_config');
     $keywords_count = isset($keywords_config['count']) && $keywords_config['count'] ? $keywords_config['count'] : 10;
     // get user additional info (address)
     $user_additional = User_additional::inst()->get_by_user_and_profile($this->c_user->id, $this->profile->id);
     // get available keywords
     $keywords = Keyword::inst()->get_user_keywords($this->c_user->id, $this->profile->id);
     if ($this->input->post()) {
         // validate posted address name
         $new_address_name = $this->input->post('address');
         $adress_error_string = User_additional::validate_address($this->input->post());
         // validate posted keywords
         $new_keywords_names = array_slice($this->input->post('keywords'), 0, $keywords_count);
         $keywords_errors = Keyword::validate_keywords($new_keywords_names);
         // chek for errors
         if (empty($adress_error_string) && empty($keywords_errors)) {
             $user_additional = $user_additional->update_address($this->input->post(), $this->c_user->id, $this->profile->id);
             $keywords = $keywords->update_keywords($new_keywords_names, $this->c_user->id, $this->profile->id);
             $this->addFlash(lang('keywords_saved_success'), 'success');
         } else {
             $address_name = $new_address_name;
             $keywords_names = array_slice(array_values($this->input->post('keywords')), 0, $keywords_count);
             $errors = array('keywords' => $keywords_errors, 'address' => $adress_error_string);
             $this->addFlash($errors);
         }
         redirect('settings/keywords');
     }
     // escape keywords names and website name
     $address_name = isset($address_name) ? HTML::chars($address_name) : HTML::chars($user_additional->address);
     $keywords_names = isset($keywords_names) ? HTML::chars_arr($keywords_names) : HTML::chars_arr(array_values($keywords->all_to_single_array('keyword')));
     JsSettings::instance()->add(array('autocomplete_url' => site_url('settings/keywords/google_autocomplete')));
     CssJs::getInst()->c_js();
     $this->template->set('address_id', $user_additional->address_id);
     $this->template->set('address_name', $address_name);
     $this->template->set('keywords_names', $keywords_names);
     $this->template->set('keywords_count', $keywords_count);
     $this->template->render();
 }
예제 #25
0
 public function plans()
 {
     $post = $this->input->post();
     if (!empty($post)) {
         if (isset($post['planId'])) {
             $selectedPlan = $post['planId'];
             redirect('auth/register/' . $selectedPlan, 'refresh');
         }
     }
     $feature = new Feature();
     $plan = new Plan();
     $this->template->set('features', $feature->get());
     $withTrial = !$this->ion_auth->logged_in();
     CssJs::getInst()->add_js('libs/eq-height.js');
     $this->template->set('plans', $plan->getActualPlans($withTrial));
     $this->template->set('options', $this->config->config['period_qualifier']);
     $this->template->render();
 }
예제 #26
0
 public function image()
 {
     CssJs::getInst()->add_js(array('controller/tests/index.js', 'ui/jquery.ui-1.9.2.min.js', 'libs/jq.file-uploader/jquery.iframe-transport.js', 'libs/jq.file-uploader/jquery.fileupload.js', 'libs/jquery.imgareaselect/scripts/jquery.imgareaselect.pack.js'))->add_css(array('ui/jquery.imgareaselect/css/imgareaselect-default.css', 'test.css'));
     $this->template->render();
 }
예제 #27
0
    <div class="wrapper">
        <?php 
echo $this->template->block('_sidebar', 'blocks/sidebar/sidebar_admin');
?>
        <?php 
echo $this->template->block('_alert', 'blocks/alert');
?>
        <div class="main">
            <?php 
echo $this->template->layout_yield();
?>
        </div>
    </div>
</div>

<?php 
echo CssJs::getInst()->get_footer_js();
?>
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-46232921-1', 'repucaution.com');
    ga('send', 'pageview');

</script>

</body>
</html>
echo $site_name;
?>
</title>
    <meta name="description" content=""/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <link rel="shortcut icon" href="<?php 
echo base_url();
?>
favicon.png">

    <?php 
echo CssJs::getInst()->get_css();
?>
    <?php 
echo CssJs::getInst()->get_header_js();
?>
    <?php 
echo JsSettings::instance()->get_settings_string();
?>
</head>

<body>
<?php 
echo $this->template->block('app_navigation', 'layouts/block/application/navigation');
?>
<!-- ======[ main container ]====== -->
<div class="main-container" id="main-container">


    <div class="main-container-inner">
예제 #29
0
 public function edit()
 {
     $options = $this->config->config['period_qualifier'];
     $error = array();
     $plan = new Plan();
     $features = new Feature();
     $request = $this->getRequest();
     //check if data was sent
     if ($this->isRequestMethod('POST')) {
         $weight = $request->request->get('plan_weight', '') ?: (int) $plan->getActualPlans()->weight + 1;
         $plan->clear();
         $plan->get_by_id($request->request->get('id'));
         $plan->weight = $weight;
         $plan->name = $request->request->get('name');
         $trial = $request->request->get('trial');
         $plan->trial = !empty($trial);
         $special = $request->request->get('special');
         $plan->special = !empty($special);
         $featuresIds = $request->request->get('feature');
         $saveFeatures = array();
         $saveFeaturesIds = array();
         //check if features was selected
         if (implode('', $featuresIds) == '') {
             $error[] = lang('attached_features_count_error');
         } else {
             $weight = 1;
             //save features of plan
             foreach ($featuresIds as $id) {
                 if ($id) {
                     $plansFeature = new Plans_feature($request->request->get('feature_' . $id . '_plansfeatureid', ''));
                     $plansFeature->feature_id = $id;
                     if ($request->request->has('feature_' . $id . '_value')) {
                         $value = $request->request->get('feature_' . $id . '_value');
                         $featureValidator = new Feature($id);
                         if ($featureValidator->validValue($value)) {
                             $plansFeature->value = $value;
                         } else {
                             $error[] = lang('attached_features_type_error', [$featureValidator->name, $featureValidator->type]);
                         }
                     }
                     $plansFeature->weight = $weight;
                     if ($plansFeature->save()) {
                         $saveFeatures[] = $plansFeature;
                         $saveFeaturesIds[] = $plansFeature->id;
                         $weight++;
                     }
                 }
             }
         }
         //save periods of plan
         $savePeriods = array();
         $savePeriodsIds = array();
         if ($count = count($request->request->get('period_id'))) {
             $periodId = $request->request->get('period_id');
             $period = $request->request->get('period');
             $qualifier = $request->request->get('qualifier');
             $price = $request->request->get('price');
             for ($i = 0; $i < $count; $i++) {
                 $planPeriod = new Plans_period($periodId[$i]);
                 $planPeriod->period = $period[$i];
                 $planPeriod->qualifier = $qualifier[$i];
                 $planPeriod->price = $price[$i];
                 if ($planPeriod->save()) {
                     $savePeriods[] = $planPeriod;
                     $savePeriodsIds[] = $planPeriod->id;
                 }
                 if ($planPeriod->error->string) {
                     $error[] = $planPeriod->error->string;
                 }
             }
         }
         //save plan with related features and period
         if (empty($error)) {
             $plan->save(array($saveFeatures, $savePeriods));
             $plan->createStripePlans();
         }
         if ($plan->errors->string) {
             $error[] = $plan->errors->string;
         }
         if (!empty($error)) {
             $this->addFlash(implode('', $error));
             $this->session->set_flashdata('recent', $request->request->all());
             $planParam = $plan->id ? '?plan=' . $plan->id : '';
             redirect('/admin/manage_plans/edit' . $planParam);
         } else {
             $plan->deleteOldPlanPeriods($savePeriodsIds);
             $plan->deleteOldPlanfeatures($saveFeaturesIds);
         }
         redirect('/admin/manage_plans/');
     }
     $planId = $request->query->get('plan', '');
     $plan->get_by_id($planId);
     $plansFeatures = $plan->getAttachedFeatures();
     $plansPeriod = $plan->plans_period->get();
     //fill data after bad validation
     if ($recent = $this->session->flashdata('recent')) {
         //recent selected features
         foreach ($plansFeatures as $planFeature) {
             $featureId = $planFeature->feature_id;
             if (in_array($featureId, $recent['feature'])) {
                 $recent['feature'] = array_diff($recent['feature'], array($featureId));
             }
         }
         //recent selected periods
         $coup = count($recent['period']);
         foreach ($plansPeriod as $planPeriod) {
             for ($i = 0; $i < $coup; $i++) {
                 if ($planPeriod->period == $recent['period'][$i] && $planPeriod->qualifier == $recent['qualifier'][$i] && $plansPeriod->price == $recent['price'][$i]) {
                     $recent['period_id'][$i] = $planPeriod->id;
                 } else {
                     $recent['period_id'][$i] = '';
                 }
             }
         }
         $this->template->set('recent', $recent);
     }
     $features->getFreeFeatures($plansFeatures);
     CssJs::getInst()->add_js('libs/test.js');
     //setting variables of template
     $this->template->set('options', $options);
     $this->template->set('features', $features);
     $this->template->set('plansFeatures', $plansFeatures);
     $this->template->set('plansPeriod', $plansPeriod);
     $this->template->set('plan', $plan);
     $this->template->render();
 }
예제 #30
0
 /**
  * - Show all accounts page, accounts loaded by ajax
  * - Save new ga profile 
  */
 public function accounts()
 {
     if (!$this->access_token->token1 or !$this->access_token->token2) {
         $this->addFlash(lang('please_connect_error'));
         redirect('settings/analytics');
     }
     if ($this->input->post()) {
         $new_profile = $this->input->post('profile');
         $account_info = Arr::extract($this->input->post(), array('account_name', 'webproperty_name', 'profile_name'));
         $this->access_token->data = serialize($account_info);
         $this->access_token->instance_id = $new_profile;
         $this->access_token->save();
         $this->addFlash(lang('profile_saved_success'), 'success');
         redirect('settings/analytics');
     }
     JsSettings::instance()->add(array('analytics' => array('get_accounts_url' => site_url('settings/analytics/get_accounts'))));
     CssJs::getInst()->c_js();
     CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js'));
     $this->template->set('account_info', $this->access_token->account_info());
     $this->template->render();
 }