示例#1
0
 public static function get_all_industry($connection)
 {
     $statement = $connection->prepare("SELECT * FROM industry");
     $statement->execute();
     $result = $statement->get_result();
     $industries = array();
     while ($row = $result->fetch_assoc()) {
         $industry = new Industry();
         $industry->set_name($row["industry"]);
         array_push($industries, $industry);
     }
     return $industries;
 }
示例#2
0
 private function generate_industries($_id)
 {
     $expertises = $this->member->getIndustries();
     $criteria = array('columns' => "id, industry, parent_id");
     $industries = Industry::find($criteria);
     echo '<select class="multiselect" id="' . $_id . '" name="' . $_id . '" multiple>' . "\n";
     foreach ($industries as $industry) {
         $css_class = '';
         $spacing = '';
         if (is_null($industry['parent_id'])) {
             $css_class = 'class = "main_industry"';
         } else {
             $spacing = '&nbsp;&nbsp;&nbsp;';
         }
         $selected = false;
         foreach ($expertises as $expertise) {
             if ($expertise['id'] == $industry['id']) {
                 $selected = true;
                 break;
             }
         }
         if ($selected) {
             echo '<option value="' . $industry['id'] . '" ' . $css_class . ' selected>' . $spacing . $industry['industry'] . '</option>' . "\n";
         } else {
             echo '<option value="' . $industry['id'] . '" ' . $css_class . '>' . $spacing . $industry['industry'] . '</option>' . "\n";
         }
     }
     echo '</select>' . "\n";
 }
示例#3
0
 private function generate_all_industry_list()
 {
     $industries = Industry::get_main();
     echo '<select id="job_filter" name="job_filter" onChange="set_job_filter();">' . "\n";
     echo '<option value="0" selected>all industries</option>' . "\n";
     echo '<option value="0" disabled>&nbsp;</option>' . "\n";
     foreach ($industries as $industry) {
         echo '<option class="main_industry" value="' . $industry['id'] . '">' . $industry['industry'] . '</option>' . "\n";
         $sub_industries = Industry::get_sub_industries_of($industry['id']);
         foreach ($sub_industries as $sub_industry) {
             echo '<option value="' . $sub_industry['id'] . '">&nbsp;&nbsp;&nbsp;' . $sub_industry['industry'] . '</option>' . "\n";
         }
     }
     echo '</select>' . "\n";
 }
示例#4
0
 private function generate_all_industry_list()
 {
     $industries = Industry::get_main();
     echo '<select class="field" id="industry" name="industry">' . "\n";
     if ($selected == '') {
         echo '<option value="0" selected>Please select an industry</option>' . "\n";
     }
     foreach ($industries as $industry) {
         echo '<option class="main_industry" value="' . $industry['id'] . '">' . $industry['industry'] . '</option>' . "\n";
         $sub_industries = Industry::get_sub_industries_of($industry['id']);
         foreach ($sub_industries as $sub_industry) {
             echo '<option value="' . $sub_industry['id'] . '">&nbsp;&nbsp;&nbsp;' . $sub_industry['industry'] . '</option>' . "\n";
         }
     }
     echo '</select>' . "\n";
 }
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'taxRates' => TaxRate::orderBy('name')->get()];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_NOTIFICATIONS) {
             $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
             return View::make('accounts.notifications', $data);
         } else {
             if ($section == ACCOUNT_IMPORT_EXPORT) {
                 return View::make('accounts.import_export');
             } else {
                 if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                     $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                     return View::make("accounts.{$subSection}", $data);
                 } else {
                     if ($section == ACCOUNT_PRODUCTS) {
                         $data = ['account' => Auth::user()->account];
                         return View::make('accounts.products', $data);
                     } else {
                         if ($section == ACCOUNT_BRANCHES) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.branches', $data);
                         } else {
                             if ($section == ACCOUNT_GROUPS) {
                                 $data = ['account' => Auth::user()->account];
                                 return View::make('accounts.groups', $data);
                             } else {
                                 if ($section == ACCOUNT_USERS) {
                                     $data = ['account' => Auth::user()->account];
                                     return View::make('accounts.user_management', $data);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
示例#6
0
 public function get_industries()
 {
     $industries = array();
     $main_industries = Industry::getMain(true);
     $i = 0;
     foreach ($main_industries as $main) {
         $industries[$i]['id'] = $main['id'];
         $industries[$i]['name'] = $main['industry'];
         $industries[$i]['job_count'] = $main['job_count'];
         $industries[$i]['is_main'] = true;
         $subs = Industry::getSubIndustriesOf($main['id'], true);
         foreach ($subs as $sub) {
             $i++;
             $industries[$i]['id'] = $sub['id'];
             $industries[$i]['name'] = $sub['industry'];
             $industries[$i]['job_count'] = $sub['job_count'];
             $industries[$i]['is_main'] = false;
         }
         $i++;
     }
     return $industries;
 }
示例#7
0
 private function generate_industries($_selected, $_name = 'industry')
 {
     $industries = array();
     $main_industries = Industry::getMain();
     $i = 0;
     foreach ($main_industries as $main) {
         $industries[$i]['id'] = $main['id'];
         $industries[$i]['name'] = $main['industry'];
         $industries[$i]['is_main'] = true;
         $subs = Industry::getSubIndustriesOf($main['id']);
         foreach ($subs as $sub) {
             $i++;
             $industries[$i]['id'] = $sub['id'];
             $industries[$i]['name'] = $sub['industry'];
             $industries[$i]['is_main'] = false;
         }
         $i++;
     }
     echo '<select class="field" id="' . $_name . '" name="' . $_name . '">' . "\n";
     if (empty($_selected) || is_null($_selected)) {
         echo '<option value="0" selected>Any Specialization</option>' . "\n";
         echo '<option value="0" disabled>&nbsp;</option>' . "\n";
     }
     foreach ($industries as $industry) {
         $selected = '';
         if ($industry['id'] == $_selected) {
             $selected = 'selected';
         }
         if ($industry['is_main']) {
             echo '<option value="' . $industry['id'] . '" class="main_industry" ' . $selected . '>';
             echo $industry['name'];
         } else {
             echo '<option value="' . $industry['id'] . '"' . $selected . '>';
             echo '&nbsp;&nbsp;&nbsp;&nbsp;' . $industry['name'];
         }
         echo '</option>' . "\n";
     }
     echo '</select>' . "\n";
 }
示例#8
0
 private function generate_industries($_id, $_selecteds, $_is_multi = false)
 {
     $industries_options_html = '';
     $criteria = array('columns' => "id, industry, parent_id");
     $industries = Industry::find($criteria);
     if ($_is_multi) {
         $industries_options_html = '<select class="multiselect" id="' . $_id . '" name="' . $_id . '[]" multiple>' . "\n";
     } else {
         $industries_options_html = '<select class="field" id="' . $_id . '" name="' . $_id . '">' . "\n";
     }
     $options_str = '';
     $has_selected = false;
     foreach ($industries as $industry) {
         $css_class = '';
         $spacing = '';
         if (is_null($industry['parent_id'])) {
             $css_class = 'class = "main_industry"';
         } else {
             $spacing = '&nbsp;&nbsp;&nbsp;';
         }
         $selected = false;
         if (in_array($industry['id'], $_selecteds)) {
             $selected = true;
             $has_selected = true;
         }
         if ($selected) {
             $options_str .= '<option value="' . $industry['id'] . '" ' . $css_class . ' selected>' . $spacing . $industry['industry'] . '</option>' . "\n";
         } else {
             $options_str .= '<option value="' . $industry['id'] . '" ' . $css_class . '>' . $spacing . $industry['industry'] . '</option>' . "\n";
         }
     }
     $industries_options_html .= '<option value="0" ' . ($has_selected ? '' : 'selected') . '>Select a Specialization</option>' . "\n";
     $industries_options_html .= '<option value="0" disabled>&nbsp;</option>' . "\n";
     $industries_options_html .= $options_str;
     $industries_options_html .= '</select>' . "\n";
     return $industries_options_html;
 }
 private static function getViewModel()
 {
     $recurringHelp = '';
     foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
         $parts = explode("=>", $line);
         if (count($parts) > 1) {
             $line = $parts[0] . ' => ' . Utils::processVariables($parts[0]);
             $recurringHelp .= '<li>' . strip_tags($line) . '</li>';
         } else {
             $recurringHelp .= $line;
         }
     }
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually'), 'recurringHelp' => $recurringHelp];
 }
示例#10
0
 private static function getViewModel()
 {
     return ['countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
 }
示例#11
0
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'branches' => Branch::where('account_id', '=', Auth::user()->account_id)->where('id', Auth::user()->branch_id)->orderBy('public_id')->get(), 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
 }
示例#12
0
 private function make_query($with_limit = false)
 {
     $is_union_buffer = false;
     // 1. work out how many match_against needed
     $match_against = array();
     // // resume keywords
     // if (!empty($this->resume_keywords['keywords'])) {
     //     $match_against['resume'] = array();
     //
     //     $keywords_str = $this->resume_keywords['keywords'];
     //     $mode = " WITH QUERY EXPANSION";
     //     if ($this->resume_keywords['is_boolean']) {
     //         $mode = " IN BOOLEAN MODE";
     //
     //         if ($this->resume_keywords['is_use_all_words']) {
     //             $keywords_str = '+'. str_replace(' ', ' +', $this->keywords['keywords']);
     //         }
     //     }
     //
     //     $match_against['resume']['member'] = "MATCH (resume_index.file_text)
     //                                           AGAINST ('". $keywords_str. "'". $mode. ")";
     //     $match_against['resume']['buffer'] = "MATCH (referral_buffers.resume_file_text)
     //                                           AGAINST ('". $keywords_str. "'". $mode. ")";
     //     $is_union_buffer = true;
     // }
     // // notes keywords
     // if (!empty($this->notes_keywords['keywords'])) {
     //     $match_against['notes'] = array();
     //
     //     $keywords_str = $this->notes_keywords['keywords'];
     //     $mode = " WITH QUERY EXPANSION";
     //     if ($this->notes_keywords['is_boolean']) {
     //         $mode = " IN BOOLEAN MODE";
     //
     //         if ($this->notes_keywords['is_use_all_words']) {
     //             $keywords_str = '+'. str_replace(' ', ' +', $this->keywords['keywords']);
     //         }
     //     }
     //
     //     $match_against['notes']['member'] = "MATCH (member_index.notes)
     //                                          AGAINST ('". $keywords_str. "'". $mode. ")";
     //     $match_against['notes']['buffer'] = "MATCH (referral_buffers.notes)
     //                                          AGAINST ('". $keywords_str. "'". $mode. ")";
     //     $is_union_buffer = true;
     // }
     // seeking keywords (members only)
     if (!empty($this->seeking_keywords['keywords'])) {
         $match_against['seeking'] = array();
         $keywords_str = $this->seeking_keywords['keywords'];
         $mode = " WITH QUERY EXPANSION";
         if ($this->seeking_keywords['is_boolean']) {
             $mode = " IN BOOLEAN MODE";
             if ($this->seeking_keywords['is_use_all_words']) {
                 $keywords_str = '+' . str_replace(' ', ' +', $this->keywords['keywords']);
             }
         }
         $match_against['seeking']['member'] = "MATCH (member_index.seeking) \n                                                   AGAINST ('" . $keywords_str . "'" . $mode . ")";
     }
     // 1.5 If filter for buffer only is turned on, then bypass the rest.
     $is_bypassed = false;
     // if ($this->filter == trim('members_only')) {
     //     $is_union_buffer = false;
     // } elseif ($this->filter == trim('buffer_only')) {
     //     $is_union_buffer = false;
     //     $is_bypassed = true;
     // }
     $salaries = array();
     $query_others = "(members.email_addr NOT LIKE '*****@*****.**' AND \n                          members.email_addr <> '*****@*****.**')";
     if (!$is_bypassed) {
         // 2. salaries
         // expected
         if ($this->expected_salary['start'] > 0) {
             $salaries['expected'] = "members.expected_salary <= " . $this->expected_salary['start'];
             if ($this->expected_salary['end'] > 0) {
                 $salaries['expected'] .= " AND members.expected_salary_end >= " . $this->expected_salary['end'];
             }
             if (!empty($this->expected_salary['currency'])) {
                 $salaries['expected'] .= " AND members.expected_salary_currency = '" . $this->expected_salary['currency'] . "'";
             }
             $salaries['expected'] = "(" . $salaries['expected'] . ")";
         }
         // 3. others
         if (!empty($this->email_addr)) {
             $query_others .= " AND members.email_addr = '" . $this->email_addr . "'";
         }
         if (!empty($this->name)) {
             $query_others .= " AND (members.firstname LIKE '%" . $this->name . "%' OR ";
             $query_others .= "members.lastname LIKE '%" . $this->name . "%')";
         }
         if (!empty($this->position)) {
             $query_others .= " AND member_job_profiles.position_title LIKE '%" . $this->position . "%'";
         }
         if (!empty($this->employer)) {
             $query_others .= " AND member_job_profiles.employer LIKE '%" . $this->employer . "%'";
         }
         if ($this->specialization > 0) {
             $sub_industries = Industry::getSubIndustriesOf($this->specialization);
             if (empty($sub_industries) || is_null($sub_industries)) {
                 $query_others .= " AND member_job_profiles.specialization = " . $this->specialization;
             } else {
                 $this->specialization .= ', ';
                 foreach ($sub_industries as $i => $sub_industry) {
                     $this->specialization .= $sub_industry['id'];
                     if ($i < count($sub_industries) - 1) {
                         $this->specialization .= ', ';
                     }
                 }
                 $query_others .= " AND member_job_profiles.specialization IN (" . $this->specialization . ")";
             }
         }
         if ($this->emp_specialization > 0) {
             $sub_industries = Industry::getSubIndustriesOf($this->specialization);
             if (empty($sub_industries) || is_null($sub_industries)) {
                 $query_others .= " AND member_job_profiles.employer_specialization = " . $this->emp_specialization;
             } else {
                 $this->emp_specialization .= ', ';
                 foreach ($sub_industries as $i => $sub_industry) {
                     $this->emp_specialization .= $sub_industry['id'];
                     if ($i < count($sub_industries) - 1) {
                         $this->emp_specialization .= ', ';
                     }
                 }
                 $query_others .= " AND member_job_profiles.employer_specialization IN (" . $this->emp_specialization . ")";
             }
         }
         if ($this->emp_desc > 0) {
             $query_others .= " AND member_job_profiles.employer_description = '" . $this->emp_desc . "'";
         }
         if ($this->notice_period > 0) {
             $query_others .= " AND members.notice_period >= " . $this->notice_period;
         }
         if ($this->total_work_years > 0) {
             $query_others .= " AND members.total_work_years >= " . $this->total_work_years;
         }
     }
     // 4. setup columns and joins
     // $columns = array();
     // if (!$is_bypassed) {
     //     $columns['member'] = "'0' AS buffer_id, members.email_addr, members.phone_num,
     //                            CONCAT(members.lastname, ', ', members.firstname) AS member_name,
     //                            resumes.name AS resume_name, resumes.file_hash, resumes.id AS resume_id";
     // }
     //
     // if ($is_union_buffer || ($is_union_buffer === false && $is_bypassed)) {
     //     $columns['buffer'] = "referral_buffers.id, referral_buffers.candidate_email,
     //                           referral_buffers.candidate_phone, referral_buffers.candidate_name,
     //                           referral_buffers.resume_file_name, referral_buffers.resume_file_hash, '0'";
     //     if ($is_union_buffer === false && $is_bypassed) {
     //         $columns['buffer'] = "referral_buffers.id AS buffer_id,
     //                               referral_buffers.candidate_email AS email_addr,
     //                               referral_buffers.candidate_phone, referral_buffers.candidate_name AS member_name,
     //                               referral_buffers.resume_file_name AS resume_name,
     //                               referral_buffers.resume_file_hash AS file_hash,
     //                               '0' AS resume_id";
     //
     //     }
     // }
     //
     // if (array_key_exists('resume', $match_against)) {
     //     $columns['member'] .= ", ". $match_against['resume']['member']. " AS resume_score";
     //
     //     if ($is_union_buffer) {
     //         $columns['buffer'] .= ", ". $match_against['resume']['buffer'];
     //     }
     //
     //     if ($is_union_buffer === false && $is_bypassed) {
     //         $columns['buffer'] .= ", ". $match_against['resume']['buffer']. " AS resume_score";
     //     }
     // }
     //
     // if (array_key_exists('notes', $match_against)) {
     //     $columns['member'] .= ", ". $match_against['notes']['member']. " AS notes_score";
     //
     //     if ($is_union_buffer) {
     //         $columns['buffer'] .= ", ". $match_against['notes']['buffer'];
     //     }
     //
     //     if ($is_union_buffer === false && $is_bypassed) {
     //         $columns['buffer'] .= ", ". $match_against['notes']['buffer']. " AS notes_score";
     //     }
     // }
     //
     // $joins = array();
     // if (!$is_bypassed) {
     //     if (array_key_exists('seeking', $match_against)) {
     //         $columns['member'] .= ", ". $match_against['seeking']['member']. " AS seeking_score";
     //
     //         if ($is_union_buffer) {
     //             $columns['buffer'] .= ", '0'";
     //         }
     //     }
     //
     //     $joins['member'] = "LEFT JOIN resumes ON resumes.member = members.email_addr
     //                         LEFT JOIN resume_index ON resume_index.resume = resumes.id";
     //     if (array_key_exists('seeking', $match_against) ||
     //         array_key_exists('notes', $match_against)) {
     //         $joins['member'] .= " LEFT JOIN member_index ON members.email_addr = member_index.member";
     //     }
     // }
     $columns = "members.email_addr, members.phone_num, members.active, \n                    CONCAT(members.lastname, ', ', members.firstname) AS member_name, \n                    DATE_FORMAT(members.updated_on, '%e %b, %Y') AS formatted_updated_on, \n                    members.is_active_seeking_job, COUNT(DISTINCT member_jobs.id) AS num_jobs_applied,\n                    NULL AS position_title, NULL AS employer, \n                    NULL AS formatted_work_from, NULL AS formatted_work_to ";
     // if (array_key_exists('seeking', $match_against)) {
     //     $columns .= ", ". $match_against['seeking']['member']. " AS seeking_score";
     // }
     $joins = "LEFT JOIN member_jobs ON member_jobs.member = members.email_addr";
     if (!empty($this->position) || !empty($this->employer) || $this->specialization > 0 || $this->emp_specialization > 0 || $this->emp_desc > 0) {
         $joins .= " LEFT JOIN member_job_profiles ON member_job_profiles.member = members.email_addr";
     }
     if (array_key_exists('seeking', $match_against)) {
         $joins .= " LEFT JOIN member_index ON members.email_addr = member_index.member";
     }
     // 5. setup query
     $query = "";
     $query = "SELECT DISTINCT " . $columns . " \n                  FROM members \n                  " . $joins . " \n                  WHERE ";
     if (!empty($match_against)) {
         $query .= $match_against['seeking']['member'] . " ";
     }
     if (!empty($salaries)) {
         if (!empty($match_against)) {
             $query .= "AND ";
         }
         $i = 0;
         foreach ($salaries as $criteria) {
             $query .= $criteria . " ";
             if ($i < count($salaries) - 1) {
                 $query .= "AND ";
             }
             $i++;
         }
     }
     if (!empty($query_others)) {
         if (!empty($match_against) || !empty($salaries)) {
             $query .= "AND ";
         }
         $query .= $query_others;
     }
     // if (!$is_bypassed) {
     //     $query = "SELECT ". $columns['member']. "
     //               FROM members
     //               ". $joins['member']. "
     //               WHERE ";
     //     if (!empty($match_against)) {
     //         $sub_query_array = array();
     //         foreach ($match_against as $table) {
     //             if (isset($table['member'])) {
     //                 $sub_query_array[] = $table['member'];
     //             }
     //         }
     //         $query .= implode(" AND ", $sub_query_array);
     //         $query .= " ";
     //     }
     //
     //     if (!empty($salaries)) {
     //         if (!empty($match_against)) {
     //             $query .= "AND ";
     //         }
     //
     //         $i = 0;
     //         foreach ($salaries as $criteria) {
     //             $query .= $criteria. " ";
     //
     //             if ($i < count($salaries)-1) {
     //                 $query .= "AND ";
     //             }
     //
     //             $i++;
     //         }
     //     }
     //
     //     if (!empty($query_others)) {
     //         if (!empty($match_against) || !empty($salaries)) {
     //             $query .= "AND ";
     //         }
     //
     //         $query .= $query_others;
     //     }
     // }
     // 6. setup union, if any
     // if ($is_union_buffer || ($is_union_buffer === false && $is_bypassed)) {
     //     if (!$is_bypassed) {
     //         $query .= " UNION ";
     //     }
     //     $query .= "SELECT ". $columns['buffer']. "
     //                FROM referral_buffers
     //                WHERE ";
     //     if (!empty($match_against)) {
     //         $sub_query_array = array();
     //         foreach ($match_against as $table) {
     //             if (isset($table['buffer'])) {
     //                 $sub_query_array[] = $table['buffer'];
     //             }
     //         }
     //         $query .= implode(" AND ", $sub_query_array);
     //         $query .= " ";
     //     }
     // }
     // 7. setup query order, limit and offset
     // if (substr(trim($this->order_by), 0, 5) == 'score') {
     //     return $query;
     // }
     $query .= " GROUP BY members.email_addr";
     $query .= " ORDER BY " . $this->order_by;
     $limit = "";
     if ($with_limit) {
         $limit = $this->offset . ", " . $this->limit;
         return $query . " LIMIT " . $limit;
     }
     return $query;
 }
示例#13
0
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'branch' => Auth::user()->branch, 'products' => Product::scope()->with('prices')->orderBy('id')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
 }
示例#14
0
<?php

include "system.php";
include_once 'class/Industry.php';
$o = new Industry();
$s = new XoopsSecurity();
$action = $_REQUEST['action'];
$isadmin = $xoopsUser->isAdmin();
$uid = $xoopsUser->getVar('uid');
switch ($action) {
    case "search":
        //return xml table to grid
        $wherestring = " WHERE industry_id>0";
        $o->showIndustry($wherestring);
        exit;
        //after return xml shall not run more code.
        break;
    case "save":
        //process submited xml data from grid
        $o->saveIndustry();
        break;
    default:
        include "menu.php";
        $xoTheme->addStylesheet("{$url}/modules/simantz/include/popup.css");
        $xoTheme->addScript("{$url}/modules/simantz/include/popup.js");
        $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
        $xoTheme->addScript("{$url}/modules/simantz/include/nitobi/nitobi.toolkit.js");
        $xoTheme->addStylesheet("{$url}/modules/simantz/include/nitobi/nitobi.grid/nitobi.grid.css");
        $xoTheme->addScript("{$url}/modules/simantz/include/nitobi/nitobi.grid/nitobi.grid.js");
        $xoTheme->addScript("{$url}/modules/simantz/include/firefox3_6fix.js");
        $o->showSearchForm();
 public function run()
 {
     // TEST DATA
     /*
     $contact = new Contact;
     $contact->first_name = 'Hillel';
     $contact->last_name = 'Hillel';
     $contact->email = '*****@*****.**';
     $contact->last_name = '2125551234';
     $client->contacts()->save($contact);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0001';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0002';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0003';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0004';
     $client->invoices()->save($invoice);
     */
     PaymentType::create(array('name' => 'Apply Credit'));
     PaymentType::create(array('name' => 'Bank Transfer'));
     PaymentType::create(array('name' => 'Cash'));
     PaymentType::create(array('name' => 'Debit'));
     PaymentType::create(array('name' => 'ACH'));
     PaymentType::create(array('name' => 'Visa Card'));
     PaymentType::create(array('name' => 'MasterCard'));
     PaymentType::create(array('name' => 'American Express'));
     PaymentType::create(array('name' => 'Discover Card'));
     PaymentType::create(array('name' => 'Diners Card'));
     PaymentType::create(array('name' => 'EuroCard'));
     PaymentType::create(array('name' => 'Nova'));
     PaymentType::create(array('name' => 'Credit Card Other'));
     PaymentType::create(array('name' => 'PayPal'));
     PaymentType::create(array('name' => 'Google Wallet'));
     PaymentType::create(array('name' => 'Check'));
     Theme::create(array('name' => 'amelia'));
     Theme::create(array('name' => 'cerulean'));
     Theme::create(array('name' => 'cosmo'));
     Theme::create(array('name' => 'cyborg'));
     Theme::create(array('name' => 'flatly'));
     Theme::create(array('name' => 'journal'));
     Theme::create(array('name' => 'readable'));
     Theme::create(array('name' => 'simplex'));
     Theme::create(array('name' => 'slate'));
     Theme::create(array('name' => 'spacelab'));
     Theme::create(array('name' => 'united'));
     Theme::create(array('name' => 'yeti'));
     InvoiceStatus::create(array('name' => 'Draft'));
     InvoiceStatus::create(array('name' => 'Sent'));
     InvoiceStatus::create(array('name' => 'Viewed'));
     InvoiceStatus::create(array('name' => 'Partial'));
     InvoiceStatus::create(array('name' => 'Paid'));
     Frequency::create(array('name' => 'Weekly'));
     Frequency::create(array('name' => 'Two weeks'));
     Frequency::create(array('name' => 'Four weeks'));
     Frequency::create(array('name' => 'Monthly'));
     Frequency::create(array('name' => 'Three months'));
     Frequency::create(array('name' => 'Six months'));
     Frequency::create(array('name' => 'Annually'));
     Industry::create(array('name' => 'Accounting & Legal'));
     Industry::create(array('name' => 'Advertising'));
     Industry::create(array('name' => 'Aerospace'));
     Industry::create(array('name' => 'Agriculture'));
     Industry::create(array('name' => 'Automotive'));
     Industry::create(array('name' => 'Banking & Finance'));
     Industry::create(array('name' => 'Biotechnology'));
     Industry::create(array('name' => 'Broadcasting'));
     Industry::create(array('name' => 'Business Services'));
     Industry::create(array('name' => 'Commodities & Chemicals'));
     Industry::create(array('name' => 'Communications'));
     Industry::create(array('name' => 'Computers & Hightech'));
     Industry::create(array('name' => 'Defense'));
     Industry::create(array('name' => 'Energy'));
     Industry::create(array('name' => 'Entertainment'));
     Industry::create(array('name' => 'Government'));
     Industry::create(array('name' => 'Healthcare & Life Sciences'));
     Industry::create(array('name' => 'Insurance'));
     Industry::create(array('name' => 'Manufacturing'));
     Industry::create(array('name' => 'Marketing'));
     Industry::create(array('name' => 'Media'));
     Industry::create(array('name' => 'Nonprofit & Higher Ed'));
     Industry::create(array('name' => 'Pharmaceuticals'));
     Industry::create(array('name' => 'Professional Services & Consulting'));
     Industry::create(array('name' => 'Real Estate'));
     Industry::create(array('name' => 'Retail & Wholesale'));
     Industry::create(array('name' => 'Sports'));
     Industry::create(array('name' => 'Transportation'));
     Industry::create(array('name' => 'Travel & Luxury'));
     Industry::create(array('name' => 'Other'));
     Industry::create(array('name' => 'Photography'));
     Size::create(array('name' => '1 - 3'));
     Size::create(array('name' => '4 - 10'));
     Size::create(array('name' => '11 - 50'));
     Size::create(array('name' => '51 - 100'));
     Size::create(array('name' => '101 - 500'));
     Size::create(array('name' => '500+'));
     PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7'));
     PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10'));
     PaymentTerm::create(array('num_days' => 14, 'name' => 'Net 14'));
     PaymentTerm::create(array('num_days' => 15, 'name' => 'Net 15'));
     PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30'));
     PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
     PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
     Currency::create(array('name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
     DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
     DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
     DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
     DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
     DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
     DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
     DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
     DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
     DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
     DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
     DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
     PaymentLibrary::create(['name' => 'Omnipay']);
     PaymentLibrary::create(['name' => 'PHP-Payments']);
     /*	
     d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
     D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
     m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
     M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
     yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
     */
     $gateways = [array('name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM'), array('name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM'), array('name' => 'CardSave', 'provider' => 'CardSave'), array('name' => 'Eway Rapid', 'provider' => 'Eway_Rapid'), array('name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'), array('name' => 'GoCardless', 'provider' => 'GoCardless'), array('name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'), array('name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'), array('name' => 'Mollie', 'provider' => 'Mollie'), array('name' => 'MultiSafepay', 'provider' => 'MultiSafepay'), array('name' => 'Netaxept', 'provider' => 'Netaxept'), array('name' => 'NetBanx', 'provider' => 'NetBanx'), array('name' => 'PayFast', 'provider' => 'PayFast'), array('name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'), array('name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'), array('name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost'), array('name' => 'PayPal Express', 'provider' => 'PayPal_Express'), array('name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'), array('name' => 'Pin', 'provider' => 'Pin'), array('name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'), array('name' => 'SagePay Server', 'provider' => 'SagePay_Server'), array('name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost'), array('name' => 'Stripe', 'provider' => 'Stripe'), array('name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking'), array('name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal'), array('name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash'), array('name' => 'TwoCheckout', 'provider' => 'TwoCheckout'), array('name' => 'WorldPay', 'provider' => 'WorldPay')];
     foreach ($gateways as $gateway) {
         Gateway::create($gateway);
     }
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     foreach ($timezones as $name => $location) {
         Timezone::create(array('name' => $name, 'location' => $location));
     }
 }
示例#16
0
 public function execute()
 {
     foreach ($this->corp_ids as $corp_id) {
         try {
             $this->db->beginTransaction();
             $this->corp = Doctrine::getTable('Entity')->find($corp_id);
             if (!$this->corp->sec_cik) {
                 if ($result = $this->getCik($this->corp->ticker)) {
                     $this->corp->sec_cik = $result['cik'];
                     if (!$this->corp->Industry->count()) {
                         if ($result['sic']['name'] && $result['sic']['name'] != '') {
                             $q = LsDoctrineQuery::create()->from('Industry i')->where('i.name = ? and i.code = ?', array($result['sic']['name'], $result['sic']['code']))->fetchOne();
                             if (!($industry = $q->fetchOne())) {
                                 $industry = new Industry();
                                 $industry->name = LsLanguage::nameize(LsHtml::replaceEntities($result['sic']['name']));
                                 $industry->context = 'SIC';
                                 $industry->code = $result['sic']['code'];
                                 $industry->save();
                             }
                             $q = LsQuery::getByModelAndFieldsQuery('BusinessIndustry', array('industry_id' => $industry->id, 'business_id' => $this->corp->id));
                             if (!$q->fetchOne()) {
                                 $this->corp->Industry[] = $industry;
                             }
                         }
                         $this->corp->save();
                         $this->corp->addReference($result['url'], null, $corp->getAllModifiedFields(), 'SEC EDGAR Page');
                     }
                 }
                 $this->corp->save();
             }
             if ($this->corp->sec_cik) {
                 $category = Doctrine::getTable('RelationshipCategory')->findOneByName('Position');
                 $this->people = $this->corp->getRelatedEntitiesQuery('Person', $category->id, 'Director', null, null, false)->execute();
                 if (count($this->people) > 1) {
                     if ($this->need_proxy) {
                         $this->getProxy();
                         $this->need_proxy = true;
                     }
                     if ($this->url) {
                         $this->paginate();
                         if ($this->pages) {
                             $this->printDebug('paginated');
                             $this->findNamePages();
                             $this->findBasicInfo();
                         } else {
                             $this->saveMeta($this->corp->id, 'error', 'not_paginated');
                             $this->printDebug('not paginated');
                         }
                     } else {
                         $this->saveMeta($this->corp->id, 'error', 'no_proxy_retrieved');
                         $this->printDebug('could not get proxy');
                     }
                 }
             }
             $this->saveMeta($this->corp->id, 'scraped', '1');
             if (!$this->testMode) {
                 $this->db->commit();
             } else {
                 $this->db->rollback();
             }
         } catch (Exception $e) {
             //something bad happened, rollback
             $this->db->rollback();
             throw $e;
         }
     }
 }
示例#17
0
 private function get_industries()
 {
     $industries = Industry::getIndustriesFromJobs(true);
     return $industries;
 }
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually')];
 }
 private static function getViewModel()
 {
     return ['sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'customLabel1' => Auth::user()->account->custom_client_label1, 'customLabel2' => Auth::user()->account->custom_client_label2];
 }
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             } else {
                 $accountGateway = AccountGateway::createNew();
                 $accountGateway->gateway_id = GATEWAY_MOOLAH;
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
             foreach ($gateways as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => $gateways, 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         if ($subSection == ACCOUNT_INVOICE_DESIGN) {
                             $invoice = new stdClass();
                             $client = new stdClass();
                             $invoiceItem = new stdClass();
                             $client->name = 'Sample Client';
                             $client->address1 = '';
                             $client->city = '';
                             $client->state = '';
                             $client->postal_code = '';
                             $client->work_phone = '';
                             $client->work_email = '';
                             $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
                             $invoice->invoice_date = date_create()->format('Y-m-d');
                             $invoice->account = json_decode(Auth::user()->account->toJson());
                             $invoice->amount = $invoice->balance = 100;
                             $invoiceItem->cost = 100;
                             $invoiceItem->qty = 1;
                             $invoiceItem->notes = 'Notes';
                             $invoiceItem->product_key = 'Item';
                             $invoice->client = $client;
                             $invoice->invoice_items = [$invoiceItem];
                             $data['invoice'] = $invoice;
                             $data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
                         }
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
示例#21
0
 function show_experiences($_experiences)
 {
     $this->SetTextColor(0);
     if (count($_experiences) <= 0) {
         $this->SetFont('Times', '', 10);
         $this->Cell(0, 5, 'No experience recorded', 0, 1, 'C');
         $this->Ln();
     } else {
         foreach ($_experiences as $experience) {
             $industry = Industry::get($experience['industry']);
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'Industry:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $industry[0]['industry'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'From:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['from'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'To:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['to'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'Place:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['place'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'Role:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['role'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'Work Summary:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['work_summary'], 0, 1, 'L');
             $this->SetFont('Times', 'B', 10);
             $this->Cell(75, 5, 'Reason for Leaving:', 0, 0, 'R');
             $this->SetFont('Times', '', 10);
             $this->Cell(0, 5, $experience['reason_for_leaving'], 0, 1, 'L');
             $this->Ln();
         }
     }
 }
示例#22
0
    } else {
        // $_POST['type'] = 'sub'
        $result = Indsutry::get_sub_industries_of($_POST['id']);
    }
    $i = 0;
    foreach ($result as $row) {
        $response[$i]['id'] = $row['id'];
        $response[$i]['name'] = $row['industry'];
        $i++;
    }
    $xml_array = array('industries' => array('industry' => $response));
} else {
    $industries = array();
    $mains = Industry::get_main();
    $i = 0;
    foreach ($mains as $main) {
        $industries[$i]['id'] = $main['id'];
        $industries[$i]['name'] = $main['industry'];
        $industries[$i]['main'] = 'Y';
        $subs = Industry::get_sub_industries_of($main['id']);
        foreach ($subs as $sub) {
            $i++;
            $industries[$i]['id'] = $sub['id'];
            $industries[$i]['name'] = $sub['industry'];
            $industries[$i]['main'] = 'N';
        }
        $i++;
    }
    $xml_array = array('industries' => array('industry' => $industries));
}
echo $xml_dom->get_xml_from_array($xml_array);
示例#23
0
 private static function getViewModel()
 {
     return ['entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels()];
 }
示例#24
0
 private function make_query($with_limit = false)
 {
     $this->log_search_criteria();
     $boolean_mode = '';
     // $match_against = "MATCH (job_index.title,
     //                          job_index.description,
     //                          job_index.state)
     //                   AGAINST ('". $this->keywords. "' IN BOOLEAN MODE)";
     $match_against = "MATCH (job_index.title) \n                          AGAINST ('+" . str_replace(' ', ' +', $this->keywords) . "' IN BOOLEAN MODE)";
     $filter_job_status = "jobs.closed = 'N' AND jobs.deleted = FALSE AND jobs.expire_on >= CURDATE()";
     $filter_employer = "jobs.employer IS NOT NULL";
     if (!empty($this->employer)) {
         $filter_employer = "jobs.employer = '" . $this->employer . "'";
     }
     $filter_industry = "jobs.industry <> 0";
     if ($this->industry > 0) {
         $children = Industry::getSubIndustriesOf($this->industry);
         $industries = '(' . $this->industry;
         if (count($children) > 0) {
             $industries .= ', ';
         }
         $i = 0;
         foreach ($children as $child) {
             $industries .= $child['id'];
             if ($i < count($children) - 1) {
                 $industries .= ', ';
             }
             $i++;
         }
         $industries .= ')';
         $filter_industry = "jobs.industry IN " . $industries;
     }
     $filter_country = "jobs.country LIKE '%'";
     if (!empty($this->country_code) && !is_null($this->country_code)) {
         $filter_country = "jobs.country = '" . $this->country_code . "'";
     }
     $filter_salary = "";
     if ($this->salary > 0) {
         $filter_salary = "jobs.salary >= " . $this->salary;
         if ($this->salary_end > 0) {
             $filter_salary = "(jobs.salary BETWEEN " . $this->salary . " AND " . $this->salary_end . ")";
         }
     }
     $filter_latest = "";
     if ($this->special == 'latest') {
         $filter_latest = "jobs.created_on BETWEEN date_add(CURDATE(), INTERVAL -5 DAY) AND CURDATE() ";
         $this->offset = 0;
         $this->limit = 10;
         $with_limit = true;
     } else {
         if ($this->special == 'top') {
             $this->order_by = "jobs.potential_reward DESC";
             $this->offset = 0;
             $this->limit = 10;
             $with_limit = true;
         }
     }
     $columns = "jobs.id, jobs.title, jobs.state, jobs.salary, jobs.salary_end, jobs.description, \n                    jobs.potential_reward, branches.currency, jobs.alternate_employer, \n                    jobs.employer AS employer_id, employers.name AS employer, \n                    industries.industry, industries.id AS industry_id, \n                    countries.country, countries.country_code, \n                    DATE_FORMAT(jobs.expire_on, '%e %b %Y') AS formatted_expire_on";
     $joins = "job_index ON job_index.job = jobs.id, \n                  employers ON employers.id = jobs.employer, \n                  employees ON employees.id = employers.registered_by, \n                  branches ON branches.id = employees.branch, \n                  industries ON industries.id = jobs.industry, \n                  countries ON countries.country_code = jobs.country";
     $match = "";
     if (!is_null($this->keywords) && !empty($this->keywords)) {
         $match .= $match_against . " AND ";
     }
     $match .= "jobs.deleted = FALSE \n                   AND " . $filter_job_status . " \n                   AND " . $filter_industry . " \n                   AND " . $filter_country . " \n                   AND " . $filter_employer . " ";
     if (!empty($filter_salary)) {
         $match .= "AND " . $filter_salary . " ";
     }
     if (!empty($filter_latest)) {
         $match .= "AND " . $filter_latest . " ";
     }
     $order = $this->order_by;
     $limit = "";
     if ($with_limit) {
         $limit = $this->offset . ", " . $this->limit;
         return array('columns' => $columns, 'joins' => $joins, 'match' => $match, 'order' => $order, 'limit' => $limit);
     }
     return array('columns' => $columns, 'joins' => $joins, 'match' => $match, 'order' => $order);
 }
示例#25
0
/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2124 $
 */
function smarty_function_get($params, &$smarty)
{
    extract($params);
    global $tb_prefix, $pdb;
    if (empty($var)) {
        $var = "item";
    }
    //depth
    if (class_exists("Industries")) {
        $industry = new Industries();
        $obj_controller = new Industry();
    } else {
        uses("industry");
        $industry = new Industries();
        $obj_controller = new Industry();
    }
    switch ($from) {
        case "market":
            $latest_commend_markets = $industry->GetArray("SELECT * FROM " . $tb_prefix . "markets WHERE if_commend='1' AND status='1' AND picture!='' ORDER BY id DESC LIMIT 0,10");
            $urls = $infos = $images = array();
            if (!empty($latest_commend_markets)) {
                while (list($key, $val) = each($latest_commend_markets)) {
                    $urls[] = $industry->getPermaLink($val['id'], null, 'market');
                    $infos[] = $val['name'];
                    $images[] = pb_get_attachmenturl($val['picture'], '', $size);
                }
                $items['url'] = implode("|", $urls);
                $items['info'] = implode("|", $infos);
                $items['image'] = implode("|", $images);
                $return = $items;
            }
            break;
        case "area":
            if (class_exists("Areas")) {
                $area = new Areas();
            } else {
                uses("area");
                $area = new Areas();
            }
            $return = $area->getLevelAreas();
            break;
        case "industry":
            $return = $industry->getCacheIndustry();
            break;
        case "type":
            if (!empty($name)) {
                $name = $obj_controller->pluralize($name);
                $industry->findIt($name);
                $return = $industry->params['data'][1];
                if (isset($multi)) {
                    $return = $obj_controller->flatten_array($return);
                }
                if (empty($var)) {
                    $var = "Items";
                }
            }
            break;
        default:
            $return = cache_read($name, $key);
            break;
    }
    if (!empty($sql)) {
        //replace table prefix
        $pdb->setFetchMode(ADODB_FETCH_ASSOC);
        $sql = str_replace("pb_", $tb_prefix, $sql);
        //for secure
        if (eregi('insert|update|delete|union|into|load_file|outfile|replace', $sql)) {
            trigger_error('no supported sql.');
        }
        //mysql_escape_string()
        $return = $industry->GetArray($sql);
    }
    $smarty->assign($var, $return);
    unset($return, $from, $item);
}
示例#26
0
文件: page.php 项目: pamalite/yel
 protected function top_search($_page_title)
 {
     // get the employers
     $criteria = array('columns' => 'employers.id, employers.name, COUNT(jobs.id) AS job_count', 'joins' => 'employers ON employers.id = jobs.employer', 'group' => 'employers.id', 'order' => 'employers.name ASC');
     $job = new Job();
     $employers = $job->find($criteria);
     if ($employers === false) {
         $employers = array();
     }
     // get the industries
     $industries = Industry::getIndustriesFromJobs(true);
     // get the countries
     $criteria = array('columns' => "countries.country_code, countries.country, COUNT(jobs.id) AS job_count", 'joins' => "countries ON countries.country_code = jobs.country", 'group' => "countries.country_code", 'order' => "countries.country ASC");
     $job = new Job();
     $countries = $job->find($criteria);
     $top = file_get_contents(dirname(__FILE__) . '/../../html/top_search.html');
     $top = str_replace('%root%', $this->url_root, $top);
     $employers_options = '';
     foreach ($employers as $emp) {
         $employers_options .= '<option value="' . $emp['id'] . '">' . desanitize($emp['name']);
         if ($emp['job_count'] > 0) {
             $employers_options .= '&nbsp;(' . $emp['job_count'] . ')';
         }
         $employers_options .= '</option>' . "\n";
     }
     $top = str_replace('<!-- %employers_options% -->', $employers_options, $top);
     $industries_options = '';
     foreach ($industries as $industry) {
         $industries_options .= '<option value="' . $industry['id'] . '">' . $industry['industry'];
         if ($industry['job_count'] > 0) {
             $industries_options .= '&nbsp;(' . $industry['job_count'] . ')';
         }
         $industries_options .= '</option>' . "\n";
     }
     $top = str_replace('<!-- %industries_options% -->', $industries_options, $top);
     $countries_options = '';
     foreach ($countries as $a_country) {
         $countries_options .= '<option value="' . $a_country['country_code'] . '">' . $a_country['country'];
         if ($a_country['job_count'] > 0) {
             $countries_options .= '&nbsp;(' . $a_country['job_count'] . ')';
         }
         $countries_options .= '</option>' . "\n";
     }
     $top = str_replace('<!-- %countries_options% -->', $countries_options, $top);
     echo $top;
 }
示例#27
0
$educations = $resume->get_educations();
$skills = $resume->get_skills();
$technical_skills = $resume->get_technical_skills();
$resume_data = array();
$resume_data['resume']['_ATTRS'] = array('candidate' => $member->get_name());
$resume_data['resume']['DISCLAIMER_NOTE'] = 'Generated from YellowElevator.com. Resume Terms of Use subjected.';
$resume_data['resume']['contacts']['telephone_number'] = $contacts[0]['phone_num'];
$resume_data['resume']['contacts']['email_address'] = $contacts[0]['email_addr'];
$resume_data['resume']['contacts']['address'] = $contacts[0]['address'];
$resume_data['resume']['contacts']['state'] = $contacts[0]['state'];
$resume_data['resume']['contacts']['country'] = Country::getCountryFrom($contacts[0]['country']);
$resume_data['resume']['work_experiences'] = array();
if (count($experiences) > 0) {
    $i = 0;
    foreach ($experiences as $experience) {
        $industry = Industry::get($experience['industry']);
        $resume_data['resume']['work_experiences']['work_experience'][$i]['industry'] = $industry[0]['industry'];
        $resume_data['resume']['work_experiences']['work_experience'][$i]['from'] = $experience['from'];
        $resume_data['resume']['work_experiences']['work_experience'][$i]['to'] = $experience['to'];
        $resume_data['resume']['work_experiences']['work_experience'][$i]['place'] = $experience['place'];
        $resume_data['resume']['work_experiences']['work_experience'][$i]['role'] = $experience['role'];
        $resume_data['resume']['work_experiences']['work_experience'][$i]['work_summary'] = $experience['work_summary'];
        $i++;
    }
}
$resume_data['resume']['educations'] = array();
if (count($educations) > 0) {
    $i = 0;
    foreach ($educations as $education) {
        $resume_data['resume']['educations']['education'][$i]['qualification'] = $education['qualification'];
        $resume_data['resume']['educations']['education'][$i]['completion_year'] = $education['completed_on'];
 public function execute()
 {
     if (!$this->safeToRun('sec')) {
         $this->printDebug('script already running');
         die;
     }
     if (!isset($this->corp_ids)) {
         return null;
     }
     foreach ($this->corp_ids as $corp_id) {
         if (!$this->override && $this->hasMeta($corp_id, 'is_complete') && $this->getMeta($corp_id, 'is_complete')) {
             $this->printDebug("Already fetched roster for Entity " . $corp_id . "; skipping...");
             continue;
         } else {
             if (!$this->override && $this->hasMeta($corp_id, 'lacks_cik') && $this->getMeta($corp_id, 'lacks_cik')) {
                 $this->printDebug("No SEC cik found for Entity " . $corp_id . "; skipping...");
                 continue;
             }
         }
         try {
             echo number_format(memory_get_usage()) . "\n";
             $this->browser->restart($this->defaultHeaders);
             $this->db->beginTransaction();
             $corp = Doctrine::getTable('Entity')->find($corp_id);
             echo "\n*****************\n\nfetching roster for " . $corp->name . " (" . $corp->ticker . ")" . "\n\n";
             //grab the corporation's cik if it doesn't have one already
             if (!$corp->sec_cik) {
                 if ($result = $this->getCik($corp->ticker)) {
                     $corp->sec_cik = $result['cik'];
                     if ($corp->Industry->count() == 0) {
                         if ($result['sic']['name'] && $result['sic']['name'] != '') {
                             if (!($industry = LsDoctrineQuery::create()->from('Industry i')->where('i.name = ? and i.code = ?', array($result['sic']['name'], $result['sic']['code']))->fetchOne())) {
                                 $industry = new Industry();
                                 $industry->name = LsLanguage::nameize(LsHtml::replaceEntities($result['sic']['name']));
                                 $industry->context = 'SIC';
                                 $industry->code = $result['sic']['code'];
                                 $industry->save();
                                 $this->printDebug('Industry: ' . $industry->name . ' (' . $industry->code . ')');
                             }
                             $q = LsQuery::getByModelAndFieldsQuery('BusinessIndustry', array('industry_id' => $industry->id, 'business_id' => $corp->id));
                             if (!$q->fetchOne()) {
                                 $corp->Industry[] = $industry;
                             }
                         }
                         $corp->save();
                         $corp->addReference($result['url'], null, $corp->getAllModifiedFields(), 'SEC EDGAR Page');
                     }
                 } else {
                     $this->saveMeta($corp->id, 'lacks_cik', true);
                     $this->db->commit();
                     continue;
                 }
             }
             if ($corp->sec_cik) {
                 $form4_urls = $this->getForm4Urls($corp->sec_cik);
                 $roster = array();
                 foreach ($form4_urls as $url_arr) {
                     $result = $this->getForm4Data($url_arr, $corp->sec_cik);
                     if ($result) {
                         $roster[] = $result;
                     }
                 }
                 $proxy_urls = $this->getProxyUrls($corp->sec_cik, array('2007', '2008'));
                 if (count($proxy_urls)) {
                     $proxy_url = $proxy_urls[0]['url'];
                     $proxy_year = $proxy_urls[0]['year'];
                     //search proxy for names appearing on form 4s
                     $roster = $this->getProxyData($roster, $proxy_url, $proxy_year);
                 } else {
                     $this->saveMeta($corp->id, 'lacks_cik', true);
                     $this->db->commit();
                     continue;
                 }
                 $corp->addReference($proxy_url, null, null, $proxy_year . ' Proxy');
                 //loop through names found on form 4s and search proxy
                 foreach ($roster as $r) {
                     echo "\n" . $r['personName'] . " is director? " . $r['isDirector'] . " at " . $r['form4Url'] . " \n";
                     if (isset($r['proxyName'])) {
                         echo "in proxy as " . $r['proxyName'] . " \n";
                     } else {
                         echo "not in proxy \n\n";
                     }
                     //make sure this appears in the proxy and has either an officer title or is a director
                     if (isset($r['proxyName']) && ($r['isDirector'] == '1' || $r['officerTitle'] != '')) {
                         $p = EntityTable::getByExtensionQuery('BusinessPerson')->addWhere('businessperson.sec_cik = ?', $r['personCik'])->fetchOne();
                         if (!$p) {
                             $p = $this->importPerson($r, $corp->name);
                         }
                         if ($p) {
                             $this->importAddress($r['address'], $p, $r, $corp->name);
                             if ($r['isDirector'] == 1) {
                                 $this->importRelationship($p, $corp, 'Director', $r);
                             }
                             if ($r['officerTitle'] != '') {
                                 $descriptions = $this->parseDescriptionStr($r['officerTitle'], $corp);
                                 foreach ($descriptions as $d) {
                                     if ($d['note']) {
                                         $position = $d['description'] . ' (' . implode(', ', $d['note']) . ')';
                                     } else {
                                         $position = $d['description'];
                                     }
                                     $this->importRelationship($p, $corp, $position, $r);
                                 }
                             }
                         }
                     }
                 }
             }
             if (!$this->testMode) {
                 $this->db->commit();
             }
             if (isset($proxy_url)) {
                 $proxy_scraper = new ProxyScraper($this->testMode, $this->debugMode, $this->appConfiguration);
                 $proxy_scraper->setCorpIds(1, $corp->id);
                 $proxy_scraper->setProxy($this->proxyText, $proxy_url, $proxy_year);
                 $proxy_scraper->disableBeep();
                 $proxy_scraper->run();
             }
         } catch (Exception $e) {
             //something bad happened, rollback
             $this->db->rollback();
             throw $e;
         }
         $this->saveMeta($corp_id, 'is_complete', true);
     }
 }
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             foreach ($data['gateways'] as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
示例#30
0
    $i = 0;
    foreach ($result as $row) {
        $response[$i]['id'] = $row['id'];
        $response[$i]['name'] = $row['industry'];
        $response[$i]['job_count'] = $row['job_count'];
        $i++;
    }
    $xml_array = array('industries' => array('industry' => $response));
} else {
    $industries = array();
    $mains = Industry::get_main_with_job_count($_SESSION['yel']['member'], $_SESSION['yel']['country_code']);
    $i = 0;
    foreach ($mains as $main) {
        $industries[$i]['id'] = $main['id'];
        $industries[$i]['name'] = $main['industry'];
        $industries[$i]['main'] = 'Y';
        $industries[$i]['job_count'] = $main['job_count'];
        $subs = Industry::get_sub_industries_with_job_count_of($main['id'], $_SESSION['yel']['member'], $_SESSION['yel']['country_code']);
        foreach ($subs as $sub) {
            $i++;
            $industries[$i]['id'] = $sub['id'];
            $industries[$i]['name'] = $sub['industry'];
            $industries[$i]['main'] = 'N';
            $industries[$i]['job_count'] = $sub['job_count'];
        }
        $i++;
    }
    $xml_array = array('industries' => array('industry' => $industries));
}
header('Content-type: text/xml');
echo $xml_dom->get_xml_from_array($xml_array);