function cold_caller_3000 () { $this->load->helper('text'); // Insert New DB Rows, If Applicable if ($this->input->post('id')) { $this->db->set('yid',$this->input->post('id')); $this->db->insert('sales_cold_calls'); } // Prepare Data $start = $this->input->get('start'); if ($start == FALSE) $start = 1; $query = $this->input->get('q'); $loc = $this->input->get('loc'); if ($loc == FALSE) { $this->db->select('zip5'); $this->db->limit(1); $this->db->order_by('RAND()'); $q = $this->db->get('addrbook'); $r = $q->row_array(); $loc = $r['zip5']; } // Prepare Request $request['start'] = $start; $request['results'] = 5; $request['appid'] = 'vLWSsN4u'; if ($query == FALSE || strtolower($query) == 'everything') $request['query'] = '*'; else $request['query'] = $query; $request['location'] = $loc; $request['output'] = 'json'; // Fetch Data $yahoo_raw = json_decode(Feed_Request('http://local.yahooapis.com/LocalSearchService/V3/localSearch',$request)); $results = array(); if ($yahoo_raw->ResultSet->totalResultsReturned > 0) { $yahoo = $yahoo_raw->ResultSet->Result; // Prepare List of Yahoo Listing IDs foreach ($yahoo as $location) $yids[] = $location->id; // Get Statuses of Businesses Already Cold Called $dbresults = array(); $this->db->where_in('yid',$yids); $db = $this->db->get('sales_cold_calls'); $db = $db->result_array(); foreach ($db as $dbresult) $status[element('yid',$dbresult)] = $dbresult['status']; foreach ($yahoo as $location) { $a_location = (array) $location; $result['id'] = $location->id; if (isset($status[$location->id])) $result['dead'] = TRUE; else $result['dead'] = FALSE; $result['name'] = element('Title', $a_location); $result['addr'] = element('Address', $a_location); $result['city'] = element('City', $a_location); $result['state'] = element('State', $a_location); $result['phone'] = element('Phone', $a_location); $result['lat'] = element('Latitude', $a_location); $result['long'] = element('Longitude', $a_location); $result['url'] = element('BusinessUrl', $a_location); //$result['domain'] = domain_filter($result['url']); $result['dist'] = element('Distance', $a_location); // Concatenate Category List $result['cats'] = null; if ( isset($location->Categories->Category) ) { foreach( $location->Categories->Category as $cat) { if (isset($cat->content)) $result['cats'] .= $cat->content.', '; } $result['cats'] = substr($result['cats'], 0, -2); } // Perform WHOIS Lookup /*if ($result['domain']) { $this->load->library('whois'); var_dump($this->whois->lookup($result['domain'])); }*/ // Send Result Array $results[] = $result; } //foreach } //if // GOOGLE MAP // Get Coordinates $coordinates = array(); foreach ($results as $result) $coordinates[] = $result['lat'].','.$result['long']; // Get Map URL $map = google_map('300x700',$coordinates); $this->load->library('pagination'); $config['base_url'] = site_url('sales_tools/cold_caller_3000').'?q='.urlencode($query).'&loc='.urlencode($loc); $config['page_query_string'] = TRUE; $config['query_string_segment'] = 'start'; $config['num_links'] = 3; $config['total_rows'] = $yahoo_raw->ResultSet->totalResultsAvailable; $config['per_page'] = $yahoo_raw->ResultSet->totalResultsReturned; $config['next_link'] = 'Next'; $config['prev_link'] = 'Previous'; $this->pagination->initialize($config); $pagination = $this->pagination->create_links(); $console['header'] = 'Results '.number_format($yahoo_raw->ResultSet->firstResultPosition).'-'.number_format($yahoo_raw->ResultSet->totalResultsReturned + $yahoo_raw->ResultSet->firstResultPosition - 1).' of '.number_format($yahoo_raw->ResultSet->totalResultsAvailable); $console['body'] = $this->load->view('sales_tools/cold_call_map', array('data'=>$results, 'map'=>$map, 'loc'=>$loc, 'query'=>$query, 'pagination'=>$pagination), TRUE); $console['footer_lt'] = null; $console['footer_rt'] = $console['header']; $data['content']['body'] = $this->load->view('console', $console, true); $data['content']['side'] = $this->load->view('_sidebar', null, true); $this->load->view('main',$data); //phpinfo(); }
<h3 class="handle">News and Blogs</h3> <?php $this->load->helper(array('text')); $feeds[] = 'http://feeds.mashable.com/Mashable'; $feeds[] = 'http://feeds.feedburner.com/nettuts'; $feeds[] = 'http://feeds.feedburner.com/psdtuts'; $feeds[] = 'http://feeds.feedburner.com/phototuts'; $feeds[] = 'http://feeds.feedburner.com/uxbooth'; $feeds[] = 'http://feeds.feedburner.com/SmashingMagazine'; $feeds[] = 'http://feeds.feedburner.com/PronetAdvertising'; $feeds[] = 'http://philsturgeon.co.uk/news/rss/all.rss'; libxml_use_internal_errors(TRUE); foreach ($feeds as $fid=>$feed) $rss[$fid] = simplexml_load_string(Feed_Request($feed)); ?> <div class="tab"> <ul> <?php foreach ($rss as $fid=>$feed) if (isset($feed->channel)) : ?> <li><a href="#blog-<?=$fid?>"><?=$feed->channel->title?></a></li> <?php endif; ?> </ul> <?php foreach ($rss as $fid=>$feed) if (isset($feed->channel)) : ?> <div id="blog-<?=$fid?>"> <ul> <?php foreach(array_slice((array)$feed->xpath('//item'),0,5) as $item) : ?> <li> <strong><a href="<?=$item->link ?>" class="headline"><?=$item->title ?></a></strong><br> <?php if (empty($item->pubDate) !== true) : ?><dt>Published <?=date_relative($item->pubDate)?></dt><?php endif; ?> </li>