Example #1
0
 /**
  * populate the geosearch markers table
  *
  * @param	 array	 $markers	list of markers to geocode
  * @return	boolean
  */
 private function _doGeocode($markers, $objProfile, $objJob, $objEvents, $objOrganizations)
 {
     $geocode = new \Hubzero\Geocode\Geocode();
     $createMarkers = array();
     foreach ($markers as $marker) {
         switch ($marker['scope']) {
             case 'job':
                 $object = $objJob->get_opening(0, 0, 0, $marker['scope_id']);
                 $address = $object->companyLocation;
                 break;
             case 'member':
                 $object = $objProfile->selectWhere('organization', 'uidNumber = ' . $marker['scope_id']);
                 $address = $object[0]->organization;
                 break;
             case 'event':
                 $object = $objEvents->find($marker['scope_id']);
                 $address = $object[0]->adresse_info;
                 break;
             case 'organization':
                 $object = $objOrganizations->find('all');
                 foreach ($object as $obj) {
                     if ($marker['scope_id'] == $obj->id) {
                         $address = $obj->organization;
                     }
                 }
                 break;
         }
         //end switch
         if ($address != "") {
             try {
                 $location = $geocode->locate($address);
                 $createMarker = new stdClass();
                 $createMarker->location = $location;
                 $createMarker->scope = $marker['scope'];
                 $createMarker->scope_id = $marker['scope_id'];
                 array_push($createMarkers, $createMarker);
             } catch (Exception $e) {
                 continue;
                 //skip bad locations
             }
         }
     }
     //end foreach
     return $createMarkers;
 }
Example #2
0
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
/* Post New Job / Edit Job Form */
$job = $this->job;
$employer = $this->employer;
$profile = $this->profile;
$id = $this->jobid;
$startdate = $job->startdate && $job->startdate != '0000-00-00 00:00:00' ? Date::of($job->startdate)->toLocal('Y-m-d') : '';
$closedate = $job->closedate && $job->closedate != '0000-00-00 00:00:00' ? Date::of($job->closedate)->toLocal('Y-m-d') : '';
$defaultExpire = $this->config->get('expiry', 0) ? Date::of(strtotime('180 days'))->toLocal('Y-m-d') : '';
$expiredate = $job->expiredate && $job->expiredate != '0000-00-00 00:00:00' ? Date::of($job->expiredate)->toLocal('Y-m-d') : $defaultExpire;
$status = $this->task != 'addjob' ? $job->status : 4;
// draft mode
$hubzero_Geo = new \Hubzero\Geocode\Geocode();
$countries = $hubzero_Geo->countries();
?>
<header id="content-header">
	<h2><?php 
echo $this->title;
?>
</h2>

	<div id="content-header-extra">
		<ul id="useroptions">
		<?php 
if ($this->emp) {
    ?>
			<li><a class="icon-dashboard myjobs btn" href="<?php 
    echo Route::url('index.php?option=' . $this->option . '&task=dashboard');
Example #3
0
 /**
  * Processes newsletter mailing actions (clicks, opens, etc) IP addresses into location data for stats
  *
  * @param   object   $job  \Components\Cron\Models\Job
  * @return  boolean
  */
 public function processIps(\Components\Cron\Models\Job $job)
 {
     // load needed libraries
     require_once PATH_CORE . DS . 'components' . DS . 'com_newsletter' . DS . 'tables' . DS . 'mailing.recipient.action.php';
     // get db
     $database = App::get('db');
     // get actions
     $newsletterMailingRecipientAction = new \Components\Newsletter\Tables\MailingRecipientAction($database);
     $unconvertedActions = $newsletterMailingRecipientAction->getUnconvertedActions();
     // convert all unconverted actions
     foreach ($unconvertedActions as $action) {
         // attempt to locate
         try {
             $location = Hubzero\Geocode\Geocode::locate($action->ip);
         } catch (Exception $e) {
             continue;
         }
         // if we got a valid result lets update our action with location info
         if (is_object($location) && $location['latitude'] != '' && $location['longitude'] != '-') {
             $sql = "UPDATE `#__newsletter_mailing_recipient_actions`\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tcountrySHORT=" . $database->quote($location['countryCode']) . ",\n\t\t\t\t\t\t\tcountryLONG=" . $database->quote($location['country']) . ",\n\t\t\t\t\t\t\tipREGION=" . $database->quote($location['region']) . ",\n\t\t\t\t\t\t\tipCITY=" . $database->quote($location['city']) . ",\n\t\t\t\t\t\t\tipLATITUDE=" . $database->quote($location['latitude']) . ",\n\t\t\t\t\t\t\tipLONGITUDE=" . $database->quote($location['longitude']) . "\n\t\t\t\t\t\tWHERE id=" . $database->quote($action->id);
             $database->setQuery($sql);
             $database->query();
         }
     }
     return true;
 }