function stateOptions()
{
    $state = new StateProvince();
    $data = $state->get_stateOptions(trim($_GET['v']), 'Y');
    if (count($data) < 1) {
        return '<input name="txtstateprovince" type="text" size="30" maxlength="100" />&nbsp;&nbsp;';
    }
    $ret .= '	<select class="select" name="txtstateprovince" onchange="javascript: cascadeStateAdmin(this.value, this.form.txt_country.value,\'txtcounty\');" >';
    $ret .= '<option value="">' . get_lang('select_text') . '</option>';
    foreach ($data as $k => $y) {
        if ($k != 'AA') {
            $ret .= "<option value='{$k}'>{$y}</option>";
        }
    }
    unset($data);
    return $ret .= '</select>';
}
 protected function SetupStateProvince()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intStateProvinceId = QApplication::QueryString('intStateProvinceId');
     if ($intStateProvinceId) {
         $this->objStateProvince = StateProvince::Load($intStateProvinceId);
         if (!$this->objStateProvince) {
             throw new Exception('Could not find a StateProvince object with PK arguments: ' . $intStateProvinceId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objStateProvince = new StateProvince();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 public function address()
 {
     $address = "";
     if (isset($this->address) && !empty($this->address)) {
         $address .= $this->address . ":";
     }
     if (isset($this->address2) && !empty($this->address2)) {
         $address .= $this->address2 . ":";
     }
     if (isset($this->city) && !empty($this->city)) {
         $city = City::find_by_code($this->country, $this->state_province, $this->county, $this->city);
         $address .= $city->name . ":";
     }
     //county
     if (isset($this->county) && !empty($this->county)) {
         $county = County::find_by_code($this->country, $this->state_province, $this->county);
         $address .= $county->name . ":";
     }
     //states
     if (isset($this->state_province) && !empty($this->state_province)) {
         $state_province = StateProvince::find_by_code($this->country, $this->state_province);
         $address .= $state_province->name . ":";
     }
     //post code
     if (isset($this->post_code) && !empty($this->post_code)) {
         $address .= $this->post_code . ":";
     }
     //country
     if (isset($this->country) && !empty($this->country)) {
         $country = Country::find_by_code($this->country);
         $address .= $country->name . ":";
     } else {
         return "";
     }
     return $address;
 }
 protected function lstHoldAtLocationStateObject_Create()
 {
     $this->lstHoldAtLocationStateObject = new QListBox($this);
     $this->lstHoldAtLocationStateObject->Name = QApplication::Translate('Hold At Location State Object');
     $this->lstHoldAtLocationStateObject->AddItem(QApplication::Translate('- Select One -'), null);
     $objHoldAtLocationStateObjectArray = StateProvince::LoadAll();
     if ($objHoldAtLocationStateObjectArray) {
         foreach ($objHoldAtLocationStateObjectArray as $objHoldAtLocationStateObject) {
             $objListItem = new QListItem($objHoldAtLocationStateObject->__toString(), $objHoldAtLocationStateObject->StateProvinceId);
             if ($this->objFedexShipment->HoldAtLocationStateObject && $this->objFedexShipment->HoldAtLocationStateObject->StateProvinceId == $objHoldAtLocationStateObject->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstHoldAtLocationStateObject->AddItem($objListItem);
         }
     }
 }
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objShipment) {
         $objObject->objShipment = Shipment::GetSoapObjectFromObject($objObject->objShipment, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intShipmentId = null;
         }
     }
     if ($objObject->objPackageType) {
         $objObject->objPackageType = PackageType::GetSoapObjectFromObject($objObject->objPackageType, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPackageTypeId = null;
         }
     }
     if ($objObject->objShippingAccount) {
         $objObject->objShippingAccount = ShippingAccount::GetSoapObjectFromObject($objObject->objShippingAccount, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intShippingAccountId = null;
         }
     }
     if ($objObject->objFedexServiceType) {
         $objObject->objFedexServiceType = FedexServiceType::GetSoapObjectFromObject($objObject->objFedexServiceType, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intFedexServiceTypeId = null;
         }
     }
     if ($objObject->objCurrencyUnit) {
         $objObject->objCurrencyUnit = CurrencyUnit::GetSoapObjectFromObject($objObject->objCurrencyUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCurrencyUnitId = null;
         }
     }
     if ($objObject->objWeightUnit) {
         $objObject->objWeightUnit = WeightUnit::GetSoapObjectFromObject($objObject->objWeightUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intWeightUnitId = null;
         }
     }
     if ($objObject->objLengthUnit) {
         $objObject->objLengthUnit = LengthUnit::GetSoapObjectFromObject($objObject->objLengthUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intLengthUnitId = null;
         }
     }
     if ($objObject->objHoldAtLocationStateObject) {
         $objObject->objHoldAtLocationStateObject = StateProvince::GetSoapObjectFromObject($objObject->objHoldAtLocationStateObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intHoldAtLocationState = null;
         }
     }
     return $objObject;
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, StateProvince::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
$ljs = $job_status ? $job_status->status_name : format_lang('none');
$smarty->assign('ljs', $ljs);
//job type
$job_t = empty($cv_details->look_job_type) ? 0 : $cv_details->look_job_type;
$job_type_arr = JobType::find_by_id($job_t);
//print_r( $job_type_arr);
$job_types = $job_type_arr ? $job_type_arr->type_name : format_lang('none');
$smarty->assign('job_type', $job_types);
//where do you wont to work
//country
$country_arry = Country::find_by_code($cv_details->country);
$country_var_name = $country_arry->var_name;
$country_name = $country_arry->name;
$smarty->assign('country', $country_name);
//states
$state = StateProvince::find_by_code($cv_details->country, $cv_details->state_province);
$state_name = empty($state) ? $cv_details->state_province : $state->name;
$state_var_name = $state ? $state->var_name : $cv_details->state_province;
$smarty->assign('state', $state_name);
$smarty->assign('state_url', $country_var_name . "/" . $state_var_name . "/");
//county
$county = County::find_by_code($cv_details->country, $cv_details->state_province, $cv_details->county);
$county_name = empty($county) ? $cv_details->county : $county->name;
$county_var_name = $county ? $county->var_name : $cv_details->county;
$smarty->assign('county', $county_name);
$smarty->assign('county_url', $country_var_name . "/" . $state_var_name . "/" . $county_var_name . "/");
$city = City::find_by_code($cv_details->country, $cv_details->state_province, $cv_details->county, $cv_details->city);
$city_name = empty($city) ? $cv_details->city : $city->name;
$city_var_name = empty($city) ? $cv_details->city : $city->var_name;
$smarty->assign('city', $city_name);
$smarty->assign('city_url', $country_var_name . "/" . $state_var_name . "/" . $county_var_name . "/" . $city_var_name . "/");
Beispiel #8
0
 protected function lstCountry_Select()
 {
     // Save the currently selected StateProvince
     $intStateProvinceId = $this->lstStateProvince->SelectedValue;
     // Clear out the items from lstAddress
     $this->lstStateProvince->RemoveAllItems();
     if ($this->lstCountry->SelectedValue) {
         // Load the selected country
         $objCountry = Country::Load($this->lstCountry->SelectedValue);
         // Get all available state/provinces for that company
         $objStateProvinceArray = $objCountry->GetStateProvinceArray();
     } else {
         // Or load all addresses for all companies
         $objStateProvinceArray = StateProvince::LoadAll();
     }
     $this->lstStateProvince->AddItem('- Select One -', null);
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             // Create a new ListItem Object
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             // If this State/Province is the one previously selected, make it selected again
             if ($intStateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             // Add the ListItem object
             $this->lstStateProvince->AddItem($objListItem);
             // Enable the input
             $this->lstStateProvince->Enabled = true;
         }
     } else {
         $this->lstStateProvince->Enabled = false;
     }
 }
 protected function lstStateProvince_Create()
 {
     $this->lstStateProvince = new QListBox($this);
     $this->lstStateProvince->Name = QApplication::Translate('State Province');
     $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null);
     $objStateProvinceArray = StateProvince::LoadAll();
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstStateProvince->AddItem($objListItem);
         }
     }
 }
Beispiel #10
0
 /**
  * Counts all associated StateProvinces
  * @return int
  */
 public function CountStateProvinces()
 {
     if (is_null($this->intCountryId)) {
         return 0;
     }
     return StateProvince::CountByCountryId($this->intCountryId);
 }
Beispiel #11
0
    /**
     * Deletes all associated StateProvinces
     * @return void
     */
    public function DeleteAllStateProvinces()
    {
        if (is_null($this->intCountryId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStateProvince on this unsaved Country.');
        }
        // Get the Database Object for this Class
        $objDatabase = Country::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StateProvince::LoadArrayByCountryId($this->intCountryId) as $objStateProvince) {
                $objStateProvince->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`state_province`
				WHERE
					`country_id` = ' . $objDatabase->SqlVariable($this->intCountryId) . '
			');
    }
 public static function recommendedJob($user_id = 0, $cvjob_title = null, $cvjob_title2 = null, $cvjob_city = null, $cvjob_county = null, $cvjob_state = null, $cvjob_country = null)
 {
     global $database, $db;
     $select = " SELECT job_title, city, county, state_province, country, fk_employer_id,var_name, created_at ";
     $select .= ", match( job.job_title, job.job_description ) against ('" . $cvjob_title . "' '+" . $cvjob_title2 . "' IN BOOLEAN MODE) as relevance ";
     $from = " FROM " . self::$table_name . " AS job ";
     $where = " WHERE job.id NOT IN ( SELECT job_h.fk_job_id from " . TBL_HISTORY . " as job_h WHERE job_h.fk_employee_id={$user_id}) ";
     $where .= " AND job.is_active='Y' AND job.job_status='approved' AND job.id > 0 ";
     //$where .= " AND var_name <> '".$old."' ";
     $where .= " AND match( job.job_title, job.job_description ) against ('" . $cvjob_title . "' '+" . $cvjob_title2 . "' IN BOOLEAN MODE)";
     $where .= " AND  DATE_ADD( job.created_at, INTERVAL " . JOBLASTFOR . " DAY ) > NOW() ";
     //$where .= " AND city='{$cvjob_city}' ";
     $where .= " AND county='{$cvjob_county}' ";
     $where .= " AND state_province='{$cvjob_state}'";
     $where .= " AND country='{$cvjob_country}'";
     $order = " ORDER BY relevance, created_at DESC ";
     $limit = " LIMIT 10 ";
     //SELECT job.job_title, job.city, job.county, job.state_province, job.country
     //FROM jobberland_job AS job
     //WHERE job.id NOT IN (SELECT job_h.fk_job_id from jobberland_job_history as job_h WHERE fk_employer_id = 1)
     $sql = $select . $from . $where . $order . $limit;
     //echo $sql;
     $result = $database->query($sql);
     $num_rows = $database->num_rows($result);
     if ($num_rows > 0) {
         $i = 1;
         $temp = array();
         while ($row = $database->fetch_object($result)) {
             $temp[$i]['job_title'] = $row->job_title;
             $temp[$i]['var_name'] = $row->var_name;
             $temp[$i]['created_at'] = strftime(DATE_FORMAT, strtotime($row->created_at));
             //country
             $country_arry = Country::find_by_code($row->country);
             $country_name = $country_arry->name;
             //states
             $state = StateProvince::find_by_code($row->country, $row->state_province);
             $state_name = empty($state) ? $row->state_province : $state->name;
             //county
             $county = County::find_by_code($row->country, $row->state_province, $row->county);
             $county_name = empty($county) ? $row->county : $county->name;
             //city
             $city = City::find_by_code($row->country, $row->state_province, $row->county, $row->city);
             $city_name = empty($city) ? $row->city : $city->name;
             $temp[$i]['location'] = $city_name . ", " . $county_name . ", " . $state_name . ", " . $country_name;
             $employer = Employer::find_by_id($row->fk_employer_id);
             $company_name = $employer->company_name;
             $temp[$i]['company_name'] = $company_name;
             //$temp[$i]['job_title'] = $row->job_title;
             //$temp[$i]['job_title'] = $row->job_title;
             $i++;
         }
         return $temp;
     }
     return false;
 }
Beispiel #13
0
 /**
  * Internally called method to assist with early binding of objects
  * on load methods.  Can only early-bind references that this class owns in the database.
  * @param string $strParentAlias the alias of the parent (if any)
  * @param string $strAlias the alias of this object
  * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
  * @param QueryExpansion an already instantiated QueryExpansion object (used as a utility object to assist with object expansion)
  */
 public static function ExpandQuery($strParentAlias, $strAlias, $objExpansionMap, QQueryExpansion $objQueryExpansion)
 {
     if ($strAlias) {
         $objQueryExpansion->AddFromItem(sprintf('LEFT JOIN `address` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`address_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`address_id` AS `%s__%s__address_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`company_id` AS `%s__%s__company_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`short_description` AS `%s__%s__short_description`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`country_id` AS `%s__%s__country_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`address_1` AS `%s__%s__address_1`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`address_2` AS `%s__%s__address_2`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`city` AS `%s__%s__city`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`state_province_id` AS `%s__%s__state_province_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`postal_code` AS `%s__%s__postal_code`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`created_by` AS `%s__%s__created_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`creation_date` AS `%s__%s__creation_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_by` AS `%s__%s__modified_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_date` AS `%s__%s__modified_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $strParentAlias = $strParentAlias . '__' . $strAlias;
     }
     if (is_array($objExpansionMap)) {
         foreach ($objExpansionMap as $strKey => $objValue) {
             switch ($strKey) {
                 case 'company_id':
                     try {
                         Company::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'country_id':
                     try {
                         Country::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'state_province_id':
                     try {
                         StateProvince::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'created_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'modified_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 default:
                     throw new QCallerException(sprintf('Unknown Object to Expand in %s: %s', $strParentAlias, $strKey));
             }
         }
     }
 }
$smarty->assign('apply_for', $jobs->job_title . " " . strtolower(format_lang('at')) . " " . $employer->company_name . " " . strtolower(format_lang('in')) . " " . $city_name . ", " . $country_name);
unset($employer, $city, $country_arry);
//Congratulations! You've applied for:
//IT Manager at IT Lab in London EC1A 9PT
if ($jobs) {
    $job_s = array();
    $i = 1;
    $job_suggestions = Job::apply_suggestion($jobs->job_title, $var_name);
    foreach ($job_suggestions as $job_suggestion) {
        $employer = Employer::find_by_id($job_suggestion->fk_employer_id);
        //locations
        //country
        $country_arry = Country::find_by_code($job_suggestion->country);
        $country_name = $country_arry->name;
        //states
        $state = StateProvince::find_by_code($job_suggestion->country, $job_suggestion->state_province);
        $state_name = empty($state) ? $job_suggestion->state_province : $state->name;
        //county
        $county = County::find_by_code($job_suggestion->country, $job_suggestion->state_province, $job_suggestion->county);
        $county_name = empty($county) ? $job_suggestion->county : $county->name;
        //city
        $city = City::find_by_code($job_suggestion->country, $job_suggestion->state_province, $job_suggestion->county, $job_suggestion->city);
        $city_name = empty($city) ? $job_suggestion->city : $city->name;
        //end
        $job_s[$i]['id'] = $job_suggestion->id;
        $job_s[$i]['var_name'] = $job_suggestion->var_name;
        $job_s[$i]['job_title'] = $job_suggestion->job_title;
        $job_s[$i]['company_name'] = $employer->company_name;
        $job_s[$i]['created_at'] = strftime(DATE_FORMAT, strtotime($job_suggestion->created_at));
        $job_s[$i]['location'] = $city_name . ", " . $county_name . ", " . $state_name . ", " . $country_name;
        $i++;
 public function dtgStateProvince_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgStateProvince->TotalItemCount = StateProvince::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgStateProvince->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgStateProvince->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgStateProvince->DataSource = StateProvince::LoadAll($objClauses);
 }
        $state = new StateProvince();
        $state->countrycode = $countrycode;
        $state->code = trim($data[0]);
        $state->var_name = $state->mod_write_check(trim($data[1]));
        $state->name = trim($data[1]);
        $save = $state->save();
    }
    fclose($file);
    $message = "<div class='success'>State codes loaded from " . $filename . " </div>";
    $session->message($message);
    redirect_to($_SERVER['PHP_SELF']);
}
//delete all the states from list
if (isset($_POST['deletestates'])) {
    global $db, $database;
    $state = new StateProvince();
    $state->delete_by_country($countrycode);
    /* We should remove the state definition from counties, cities and zips tables also for this country */
    $db->query("update " . TBL_COUNTIES . " set statecode='' where countrycode='{$countrycode}' ");
    $db->query("update " . TBL_CITY . " set statecode='' where countrycode='{$countrycode}' ");
    $message = "<div class='success'>State codes for #COUNTRY# are deleted </div>";
    $message = str_replace('#COUNTRY#', $countrycode, $message);
    /* Analyze the table to adjust index values */
    //$db->optimize_table( TBL_COUNTRY );
    $db->optimize_table(TBL_STATES);
    $db->optimize_table(TBL_COUNTIES);
    $db->optimize_table(TBL_CITY);
    $session->message($message);
    redirect_to($_SERVER['PHP_SELF']);
}
//get the states files
Beispiel #17
0
 $smarty->assign('jobtype', $type2);
 $smarty->assign('var_name', $jobs->var_name);
 $smarty->assign('job_ref', $jobs->job_ref);
 $smarty->assign('job_title', $jobs->job_title);
 $smarty->assign('job_description', $jobs->job_description);
 $smarty->assign('job_postion', $jobs->job_postion);
 //locations
 //country
 $country_arry = Country::find_by_code($jobs->country);
 //$country_a($country_arry) ? $country_arry->code : $country_a;
 $country_var_name = $country_arry->var_name;
 $country_name = $country_arry->name;
 $smarty->assign('country', $country_name);
 $smarty->assign('country_url', $country_var_name);
 //states
 $state = StateProvince::find_by_code($jobs->country, $jobs->state_province);
 $state_name = empty($state) ? $jobs->state_province : $state->name;
 $state_var_name = $state ? $state->var_name : $jobs->state_province;
 $smarty->assign('state', $state_name);
 $smarty->assign('state_url', $country_var_name . "/" . $state_var_name . "/");
 //county
 $county = County::find_by_code($jobs->country, $jobs->state_province, $jobs->county);
 $county_name = empty($county) ? $jobs->county : $county->name;
 $county_var_name = $county ? $county->var_name : $jobs->county;
 $smarty->assign('county', $county_name);
 $smarty->assign('county_url', $country_var_name . "/" . $state_var_name . "/" . $county_var_name . "/");
 $city = City::find_by_code($jobs->country, $jobs->state_province, $jobs->county, $jobs->city);
 $city_name = empty($city) ? $jobs->city : $city->name;
 $city_var_name = empty($city) ? $jobs->city : $city->var_name;
 $smarty->assign('city', $city_name);
 $smarty->assign('city_url', $country_var_name . "/" . $state_var_name . "/" . $county_var_name . "/" . $city_var_name . "/");
Beispiel #18
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objCompany) {
         $objObject->objCompany = Company::GetSoapObjectFromObject($objObject->objCompany, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCompanyId = null;
         }
     }
     if ($objObject->objCountry) {
         $objObject->objCountry = Country::GetSoapObjectFromObject($objObject->objCountry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCountryId = null;
         }
     }
     if ($objObject->objStateProvince) {
         $objObject->objStateProvince = StateProvince::GetSoapObjectFromObject($objObject->objStateProvince, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intStateProvinceId = null;
         }
     }
     if ($objObject->objCreatedByObject) {
         $objObject->objCreatedByObject = UserAccount::GetSoapObjectFromObject($objObject->objCreatedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCreatedBy = null;
         }
     }
     if ($objObject->dttCreationDate) {
         $objObject->dttCreationDate = $objObject->dttCreationDate->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objModifiedByObject) {
         $objObject->objModifiedByObject = UserAccount::GetSoapObjectFromObject($objObject->objModifiedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intModifiedBy = null;
         }
     }
     return $objObject;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this StateProvinceMetaControl
  * @param integer $intStateProvinceId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing StateProvince object creation - defaults to CreateOrEdit
  * @return StateProvinceMetaControl
  */
 public static function Create($objParentObject, $intStateProvinceId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intStateProvinceId)) {
         $objStateProvince = StateProvince::Load($intStateProvinceId);
         // StateProvince was found -- return it!
         if ($objStateProvince) {
             return new StateProvinceMetaControl($objParentObject, $objStateProvince);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a StateProvince object with PK arguments: ' . $intStateProvinceId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new StateProvinceMetaControl($objParentObject, new StateProvince());
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = StateProvince::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from StateProvince, given the clauses above
     $this->DataSource = StateProvince::QueryArray($objCondition, $objClauses);
 }
Beispiel #21
0
 protected function lstHoldAtLocationState_Create()
 {
     $this->lstHoldAtLocationState = new QListBox($this->pnlFedExShipment);
     $this->lstHoldAtLocationState->Name = QApplication::Translate('Hold at Location State');
     $this->lstHoldAtLocationState->AddItem(QApplication::Translate('- Select One -'), null);
     $objStateProvinceArray = StateProvince::LoadAll();
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($this->blnEditMode && $this->objFedexShipment && $this->objFedexShipment->HoldAtLocationState && $this->objFedexShipment->HoldAtLocationState == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstHoldAtLocationState->AddItem($objListItem);
         }
     }
     $this->lstHoldAtLocationState->TabIndex = 30;
 }
 }
 $default_county = $_SESSION['loc']['country'];
 $countrycode = $default_county = !empty($default_county) ? $default_county : "GB";
 $_SESSION['loc']['country'] = $countrycode = $default_county = !empty($default_county) ? $default_county : "GB";
 $country = Country::find_all_order_by_name();
 if (is_array($country) && !empty($country)) {
     $country_t = array();
     $country_t['AA'] = 'All Countries';
     foreach ($country as $co) {
         if ($val['code'] != 'AA') {
             $country_t[$co->code] = $co->name;
         }
     }
     $smarty->assign('country', $country_t);
 }
 $state = new StateProvince();
 $county = new County();
 $city = new City();
 $lang['states'] = $state->get_stateOptions($countrycode, 'N');
 if (count($lang['states']) == 1) {
     foreach ($lang['states'] as $key => $val) {
         $_SESSION['loc']['stateprovince'] = $key;
     }
 }
 //status
 $_SESSION['loc']['stateprovince'] = $_SESSION['loc']['stateprovince'] != '' ? $_SESSION['loc']['stateprovince'] : "";
 if ($_SESSION['loc']['stateprovince'] != '') {
     $lang['counties'] = $county->get_countyOptions($countrycode, $_SESSION['loc']['stateprovince'], 'N');
     if (count($lang['counties']) == 1) {
         foreach ($lang['counties'] as $key => $val) {
             $_SESSION['loc']['countycode'] = $key;
 /**
  * Refresh this MetaControl with Data from the local Address object.
  * @param boolean $blnReload reload Address from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objAddress->Reload();
     }
     if ($this->lblAddressId) {
         if ($this->blnEditMode) {
             $this->lblAddressId->Text = $this->objAddress->AddressId;
         }
     }
     if ($this->lstCompany) {
         $this->lstCompany->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCompany->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCompanyArray = Company::LoadAll();
         if ($objCompanyArray) {
             foreach ($objCompanyArray as $objCompany) {
                 $objListItem = new QListItem($objCompany->__toString(), $objCompany->CompanyId);
                 if ($this->objAddress->Company && $this->objAddress->Company->CompanyId == $objCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCompany->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCompanyId) {
         $this->lblCompanyId->Text = $this->objAddress->Company ? $this->objAddress->Company->__toString() : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objAddress->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objAddress->ShortDescription;
     }
     if ($this->lstCountry) {
         $this->lstCountry->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCountryArray = Country::LoadAll();
         if ($objCountryArray) {
             foreach ($objCountryArray as $objCountry) {
                 $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId);
                 if ($this->objAddress->Country && $this->objAddress->Country->CountryId == $objCountry->CountryId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCountry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCountryId) {
         $this->lblCountryId->Text = $this->objAddress->Country ? $this->objAddress->Country->__toString() : null;
     }
     if ($this->txtAddress1) {
         $this->txtAddress1->Text = $this->objAddress->Address1;
     }
     if ($this->lblAddress1) {
         $this->lblAddress1->Text = $this->objAddress->Address1;
     }
     if ($this->txtAddress2) {
         $this->txtAddress2->Text = $this->objAddress->Address2;
     }
     if ($this->lblAddress2) {
         $this->lblAddress2->Text = $this->objAddress->Address2;
     }
     if ($this->txtCity) {
         $this->txtCity->Text = $this->objAddress->City;
     }
     if ($this->lblCity) {
         $this->lblCity->Text = $this->objAddress->City;
     }
     if ($this->lstStateProvince) {
         $this->lstStateProvince->RemoveAllItems();
         $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null);
         $objStateProvinceArray = StateProvince::LoadAll();
         if ($objStateProvinceArray) {
             foreach ($objStateProvinceArray as $objStateProvince) {
                 $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
                 if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStateProvince->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStateProvinceId) {
         $this->lblStateProvinceId->Text = $this->objAddress->StateProvince ? $this->objAddress->StateProvince->__toString() : null;
     }
     if ($this->txtPostalCode) {
         $this->txtPostalCode->Text = $this->objAddress->PostalCode;
     }
     if ($this->lblPostalCode) {
         $this->lblPostalCode->Text = $this->objAddress->PostalCode;
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objAddress->CreatedByObject && $this->objAddress->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objAddress->CreatedByObject ? $this->objAddress->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objAddress->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objAddress->CreationDate) ? $this->objAddress->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objAddress->ModifiedByObject && $this->objAddress->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objAddress->ModifiedByObject ? $this->objAddress->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objAddress->ModifiedDate;
         }
     }
     if ($this->lstAddressCustomFieldHelper) {
         $this->lstAddressCustomFieldHelper->RemoveAllItems();
         $this->lstAddressCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressCustomFieldHelperArray = AddressCustomFieldHelper::LoadAll();
         if ($objAddressCustomFieldHelperArray) {
             foreach ($objAddressCustomFieldHelperArray as $objAddressCustomFieldHelper) {
                 $objListItem = new QListItem($objAddressCustomFieldHelper->__toString(), $objAddressCustomFieldHelper->AddressId);
                 if ($objAddressCustomFieldHelper->AddressId == $this->objAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddressCustomFieldHelper->AddItem($objListItem);
             }
         }
         // Because AddressCustomFieldHelper's AddressCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
         if ($this->lstAddressCustomFieldHelper->SelectedValue) {
             $this->lstAddressCustomFieldHelper->Enabled = false;
         } else {
             $this->lstAddressCustomFieldHelper->Enabled = true;
         }
     }
     if ($this->lblAddressCustomFieldHelper) {
         $this->lblAddressCustomFieldHelper->Text = $this->objAddress->AddressCustomFieldHelper ? $this->objAddress->AddressCustomFieldHelper->__toString() : null;
     }
 }
Beispiel #24
0
 protected function lstCountry_Select($strFormId, $strControlId, $strParameter)
 {
     // Save the currently selected StateProvince
     $intStateProvinceId = $this->lstStateProvince->SelectedValue;
     // Clear out the items from lstAddress
     $this->lstStateProvince->RemoveAllItems();
     if ($this->lstCountry->SelectedValue) {
         // Load the selected country
         $objCountry = Country::Load($this->lstCountry->SelectedValue);
         // Get all available state/provinces for that company
         $objStateProvinceArray = $objCountry->GetStateProvinceArray();
     } else {
         // Or load all addresses for all companies
         $objStateProvinceArray = StateProvince::LoadAll();
     }
     $this->lstStateProvince->AddItem('- Select One -', null);
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($intStateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstStateProvince->AddItem($objListItem);
             $this->lstStateProvince->Enabled = true;
         }
     } else {
         $this->lstStateProvince->Enabled = false;
     }
 }
         $i++;
     }
     $smarty->assign('activeLink', $activeLink);
 }
 ///jobs
 $job_by_locations = Job::list_job_by_location($country_code);
 if ($job_by_locations2) {
     $location = array();
     $i = 1;
     foreach ($job_by_locations as $job_by_location) {
         //city
         $city_code = City::find_by_code($country_a, null, null, $job_by_location->city);
         $city_var_name = $city_code ? $city_code->var_name : $job_by_location->city;
         //states
         $state_code = $job_by_location->state_province;
         $state_ = StateProvince::find_by_code($country_a, $state_code);
         $state_var_name = $state_ ? $state_->var_name : $job_by_location->state_province;
         //county
         $county_code = $job_by_location->county;
         $county_ = County::find_by_code($country_a, $state_code, $county_code);
         $county_var_name = $county_ ? $county_->var_name : $job_by_location->county;
         if ($city_code) {
             /**check length of text */
             $location_name = strlen($city_code->name) > 60 ? substr($city_code->name, 0, 30) . " ... " : $city_code->name;
         } else {
             /**check length of text */
             $location_name = strlen($city_var_name) > 60 ? substr($city_var_name, 0, 30) . " ... " : $city_var_name;
         }
         $total_jobs = Job::get_total_job_by_location($country_a, null, null, $job_by_location->city);
         $location[$i]['total'] = $total_jobs;
         $location[$i]['name'] = $location_name;