function run_reactivex() { $docs = load_all_docs(); $repoRoot = __DIR__ . '/reactivex.github.io'; $docsPath = $repoRoot . '/documentation/operators/'; if (!is_dir($docsPath)) { println("Expecting a valid reactivex.io checkout at @ {$docsPath}"); exit(1); } // Change to reactivex doc repository chdir($repoRoot); if (!is_clean_git_checkout(getcwd())) { println("ReactiveX docs checkout should be clean at:"); println(" " . $repoRoot); exit(1); } $reactivexDocs = load_all_reactivex_docs($docsPath); $grouped_docs = group_by($docs, function ($item) { return $item->reactivexId; }); $diff = array_diff(array_keys($grouped_docs), array_keys($reactivexDocs)); if (count($diff) != 0) { println("ReactiveX id(s) '%s' not found", implode(', ', $diff)); exit(1); } foreach ($grouped_docs as $id => $docs) { update_documentation($reactivexDocs[$id], $docs); } exit(0); }
$count_questions = $r <= $percent_sessions[0] ? rand(0, count($test->all_questions) - 1) : count($test->all_questions) - 1; for ($q = 0; $q < $count_questions; $q++) { $question = $test->all_questions[$i]; $answer = $question->all_answers[rand(0, count($question->all_answers) - 1)]; stat_question_answered($session_id, $test->id, $partner_id, $day, $question->id, $answer->id, $test->all_questions[$i + 1]->id, $test->sms_enabled); } if ($r > $percent_sessions[0]) { $question = $test->all_questions[count($test->all_questions) - 1]; $answer = $question->all_answers[rand(0, count($question->all_answers) - 1)]; stat_test_finished($session_id, $test->id, $partner_id, $day, $question->id, $answer->id, $test->sms_enabled, random_string(REATESTER_SMS_CHAL_LENGTH), random_string(REATESTER_SMS_RESP_LENGTH)); if ($r > $percent_sessions[1]) { stat_sms_received($session_id, $test->id, $partner_id, $day, $test->sms_enabled, 300, 200); } } } $daily_statistics_by_partner = group_by(DailyStatistics::query("ORDER BY day"), "partner_id"); $payment_dates = array(); for ($i = 0; $i < $payment_count; $i++) { $payment_dates[] = time() - rand(0, 60 * 60 * 24 * $time_range); } sort($payment_dates); $partner_last_payment = array(); $partner_last_stat_index = array(); for ($i = 0; $i < count($all_partners); $i++) { $partner_last_payment[] = null; $partner_last_stat_index[$i] = 0; } for ($i = 0; $i < $payment_count; $i++) { $payment = new Payment(); $payment->transferred_at = $payment_dates[$i]; $payment->partner_id = $all_partners[rand(0, count($all_partners) - 1)]->id;
echo bu::view('path_block'); ?> <? if($data->getInfo()):?> <div class='category_info'> <?php echo $data->getInfo(); ?> </div> <? endif ?> <? if ($data->getSubDirs()):?> <div id="subdirs"> <? $sub_dirs = $data->getSubDirs(); if(count($sub_dirs) > 20){ $groups = group_by(function($k, $v){ return strtolower(first_letter($v->getName())); }, $data->getSubDirs()); ksort($groups); $columns = group_by_column($groups, 3); echo "<table><tr>"; foreach($columns as $groups){ echo "<td width='230px' style='vertical-align: top'>"; foreach($groups as $letter => $group){ echo "<h2>".strtoupper($letter)."</h2>"; echo "<ul>"; foreach($group as $v) echo "<li><a href='".$v->getHref()."'>".$v->getName()."</a></li>"; echo "</ul>"; } echo "</td>"; } echo "</tr></table>";
public function index($purpose = false, $parameters = array()) { $category_ids = $possible_categories = $cities = $possible_cities = $postalcodes = array(); $page = $minprice = $maxprice = $rooms = false; $limit = 12; $purpose_titles = array('te-koop' => 'te koop', 'te-huur' => 'te huur'); $purpose_slugs = array(1 => 'te-koop', 2 => 'te-huur'); $purpose_slugs_id = array('te-koop' => 1, 'te-huur' => 2); $categories = array(1 => 'Huis', 2 => 'Appartement', 3 => 'Grond', 4 => 'Serviceflat', 5 => 'Kamer', 6 => 'Parking', 7 => 'Andere', 8 => 'Horeca', 9 => 'Kantoor', 10 => 'Industrie', 11 => 'Winkel', 12 => 'Andere (pro)', 13 => 'Grond (pro)'); $categories_slugs = array(1 => 'huis', 2 => 'appartement', 3 => 'grond', 4 => 'serviceflat', 5 => 'kamer', 6 => 'parking', 7 => 'andere', 8 => 'horeca', 9 => 'kantoor', 10 => 'industrie', 11 => 'winkel', 12 => 'andere-pro', 13 => 'grond-pro'); $category_slugs_id = array_flip($categories_slugs); $max_price = $purpose_slugs_id[$purpose] == 1 ? 600000 : 3000; $min_price = $purpose_slugs_id[$purpose] == 1 ? 75000 : 1000; $price = $min_price; $step = $purpose_slugs_id[$purpose] == 1 ? 25000 : 250; while ($price <= $max_price) { $prices[] = $price; if ($purpose_slugs_id[$purpose] == 1) { if ($price == 250000) { $step = $step * 2; } } $price += $step; } foreach (group_by('category')->where('purpose = %d', $purpose_slugs_id[$purpose])->get('skarabee/property') as $property) { $possible_categories[] = $property->category; } foreach (group_by('city')->where('purpose = %d', $purpose_slugs_id[$purpose])->get('skarabee/property') as $property) { $possible_cities[] = array($property->postal => $property->city); } if (isset($_POST) && count($_POST) > 0) { $segments = array(); if (isset($_POST['types'])) { foreach ($_POST['types'] as $type) { $segments[] = $categories_slugs[$type]; } } if (isset($_POST['rooms']) && $_POST['rooms'] > 0) { $segments[] = intval($_POST['rooms']) . '-slaapkamers'; } if (isset($_POST['price']) && $_POST['price'] > 0 && $_POST['price'] < end($prices)) { $segments[] = 'prijs-tot-' . intval($_POST['price']); } elseif (isset($_POST['price']) && $_POST['price'] > 0 && $_POST['price'] == end($prices)) { $segments[] = 'prijs-vanaf-' . intval($_POST['price']); } if (isset($_POST['cities']) && count($_POST['cities']) > 0) { $segments[] = 'postcode-' . implode('-', array_unique($_POST['cities'])); } redirect(url($purpose . '/' . implode('/', $segments))); } foreach ($parameters as $argkey => $arg) { if (isset($category_slugs_id[$arg])) { $category_ids[] = $category_slugs_id[$arg]; continue; } else { if (preg_match('/postcode-([0-9\\-]+)/is', $arg, $match)) { $postalcodes = explode('-', $match[1]); continue; } else { if (preg_match('/(\\d+)-slaapkamers/is', $arg, $match)) { $rooms = $match[1]; continue; } else { if (preg_match('/prijs-vanaf-(\\d+)/is', $arg, $match)) { $minprice = $match[1]; continue; } else { if (preg_match('/prijs-tot-(\\d+)/is', $arg, $match)) { $maxprice = $match[1]; continue; } else { if (preg_match('/pagina-(\\d+)/is', $arg, $match)) { $page = $match[1]; unset($parameters[$argkey]); continue; } } } } } } } $query = where('purpose = %d AND sold = 0', $purpose_slugs_id[$purpose]); if (!$page) { $page = 1; } if (count($category_ids)) { $query->where('category IN %$', $category_ids); } if (count($postalcodes)) { $query->where('postal IN %$', $postalcodes); } if ($rooms && $rooms < 5) { $query->where('rooms <= %d', $rooms); } else { if ($rooms && $rooms == 5) { $query->where('rooms >= %d', $rooms); } } if ($minprice) { $query->where('price >= %d', $minprice); } if ($maxprice) { $query->where('price <= %d', $maxprice); } $amount = $query->count_rows('skarabee/property'); $properties = $query->limit($limit)->page($page)->get('skarabee/property'); $offer = where('slug = %s', $purpose)->get_row('offer/purpose'); echo view('head', array('class' => 'offer content', 'css' => 'offer', 'title' => $offer && $offer->seo_title ? $offer->seo_title : 'Aanbod ' . $purpose_titles[$purpose], 'description' => $offer && $offer->seo_content ? $offer->seo_content : '')); echo view('offer', array('purpose_titles' => $purpose_titles, 'purpose_slugs' => $purpose_slugs, 'purpose' => $purpose, 'possible_categories' => $possible_categories, 'categories' => $categories, 'category_ids' => $category_ids, 'rooms' => $rooms, 'prices' => $prices, 'minprice' => $minprice, 'maxprice' => $maxprice, 'possible_cities' => $possible_cities, 'cities' => $cities, 'postalcodes' => $postalcodes, 'page' => $page, 'pages' => ceil($amount / $limit), 'amount' => $amount, 'properties' => $properties, 'display' => isset($_COOKIE['display']) ? $_COOKIE['display'] : 'grid', 'segments' => $parameters)); echo view('foot', array('js' => 'offer')); }