/** * @see parent::initHtmlData */ public function initHtmlData() { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $pid = $this->parseLinks(); if ($pid) { $pid = array_map('intval', $pid); $stop_words = new stop_words(); $projects = new_projects::getProjectsById($pid); foreach ($projects as $i => $project) { $sTitle = $project['moderator_status'] === '0' && $project['kind'] != 4 && $project['is_pro'] != 't' ? $stop_words->replace($project['name']) : $project['name']; $projects[$i]['sTitle'] = reformat2($sTitle, 30, 0, 1); $projects[$i]['friendly_url'] = $this->getLinkById($project['id']); $projects[$i]['str_cost'] = $project['cost'] ? CurToChar($project['cost'], $project['currency']) . getPricebyProject($project['priceby']) : 'По договоренности'; } $this->html_data = $projects; } }
<div class="fl2_date_day"> <?php echo str_ago_pub($project->getCreateDateEx()); ?> </div> <div class="fl2_date_date"> <?php echo strftime("%d ", $project->getCreateDateEx()) . monthtostr(strftime("%m", $project->getCreateDateEx())) . ", " . $daysOfWeek[date("N", $project->getCreateDateEx())]; ?> </div> <div class="clear"></div> </div> <div class="fl2_offer"> <?php if ($prj['cost']) { $priceby_str = getPricebyProject($prj['priceby']); ?> <div class="fl2_offer_budget">Бюджет: <?php if (hasPermissions('projects') && $user->login != $_SESSION["login"]) { ?> <a id="prj_budget_lnk_<?php echo $prj['id']; ?> " class="b-post__link b-post__link_dot_6db335" href="#" onClick="popupShowChangeBudget(<?php echo $prj['id']; ?> , '<?php echo $prj['cost']; ?> ', '<?php echo $prj['currency'];
<?php seo_start($is_ajax); ?> <?php if ($row['cost']) { $priceby_str = getPricebyProject($row['priceby']); if ($row['cost'] == '' || $row['cost'] == 0) { $priceby_str = ""; } ?> <div class="b-post__price b-post__price_padleft_10 b-post__price_padbot_5 b-post__price_fontsize_15 b-post__price_bold b-post__price_float_right"> <?php if ($can_change_prj) { ?> <a id="prj_budget_lnk_<?php echo $row['id']; ?> " class="b-post__link b-post__link_dot_6db335" href="#" onClick="popupShowChangeBudget(<?php echo $row['id']; ?> , '<?php echo $row['cost']; ?> ', '<?php echo $row['currency']; ?> ', '<?php echo $row['priceby'];
/** * @todo: замена NewProj * * Рассылка о новых проектах за предыдущий день. Вызывается раз в день из hourly.php * * @param array $uids - массив идентификаторов пользователей, которых нужно исключить * * @return int количество получивших рассылку */ public function NewProj2($uids = array()) { $show_pro_limit = 25; $show_limit = 25; $projects = projects::GetNewProjectsPreviousDay($error, true); $groups = professions::GetAllGroupsLite(true); $page = 0; $count = 0; $projects_count = count($projects); if (!$projects_count) { return false; } //Получаем баннеры $settings = new settings(); $banner_file = $settings->GetVariable('newsletter', 'banner_file'); $banner_link = $settings->GetVariable('newsletter', 'banner_link'); $this->subject = 'Новые проекты на FL.ru'; $this->message = Template::render($_SERVER['DOCUMENT_ROOT'] . '/templates/mail/new_projects/project_layout.tpl.php', array('projects' => '%MESSAGE%', 'host' => $GLOBALS['host'], 'title' => '%TITLE%', 'unsubscribe_url' => '%UNSUBSCRIBE_URL%', 'date' => strtotime('- 1 day'), 'track_url' => '%TRACK_URL%')); $this->recipient = ''; $massId = $this->send('text/html'); $project_ids = array(); foreach ($projects as $i => $prj) { $descr = $prj['descr']; $descr = htmlspecialchars($descr, ENT_QUOTES, 'CP1251', false); $descr = reformat(LenghtFormatEx($descr, 180), 50, 0, 1); $price = $prj['cost'] ? CurToChar($prj['cost'], $prj['currency']) . getPricebyProject($prj['priceby']) : null; $projects[$i]['html'] = Template::render($_SERVER['DOCUMENT_ROOT'] . '/templates/mail/new_projects/project.tpl.php', array('url' => $GLOBALS['host'] . getFriendlyURL('project', array('id' => $prj['id'], 'name' => $prj['name'])), 'name' => $prj['name'] ? reformat(htmlspecialchars($prj['name'], ENT_QUOTES, 'CP1251', false), 50, 0, 1) : '', 'descr' => $descr, 'host' => $GLOBALS['host'], 'project_kind' => $prj['kind'], 'project_pro_only' => $prj['pro_only'] == 't', 'project_verify_only' => $prj['verify_only'] == 't', 'project_urgent' => $prj['urgent'] == 't', 'price' => $price, 'end_date' => $prj['end_date'], 'create_date' => $prj['create_date'], 'utm_param' => '%UTM_PARAM%')); $project_ids[] = $prj['id']; } //Собираем юзеров у которых есть ответы на новые проекты $offers_exist = array(); $offers = projects_offers::AllFrlOffersByProjectIDs($project_ids); if (count($offers)) { foreach ($offers as $offer) { if (!isset($offers_exist[$offer['project_id']])) { $offers_exist[$offer['project_id']] = array(); } $offers_exist[$offer['project_id']][$offer['user_id']] = true; } } $strtotime_3y_ago = strtotime('- 3 year'); $strtotime_1y_ago = strtotime('- 1 year'); $strtotime_1w_ago = strtotime('- 1 week'); $current_date = time(); $current_date_sufix = '_' . date('dmy', $current_date); //format:_270314 $statistics = array(); while ($users = freelancer::GetPrjRecps($error, ++$page, 200, $uids)) { $this->recipient = array(); foreach ($users as $user) { //Если ли у фрилансера уточнение по категориям $is_mailer_str = strlen($user['mailer_str']) > 0; $subj = array(); if ($is_mailer_str) { foreach ($groups as $group) { if (freelancer::isSubmited($user['mailer_str'], array(array('category_id' => $group['id'])))) { $subj[$group['id']] = $group['name']; } } } $message_pro = ''; $cnt_pro = 0; $message = ''; $cnt = 0; $cnt_submited = 0; $cnt_user_submited = 0; foreach ($projects as $prj) { //Подписан ли фрилансер на специализацию к которой относится проект if ($is_mailer_str && !freelancer::isSubmited($user['mailer_str'], $prj['specs'])) { continue; } //Считаем все проекты по выбранным специализациям ++$cnt_submited; //Условия не попадания в письмо if ($prj['is_blocked'] == 't' || $prj['closed'] == 't' || $prj['state'] == projects::STATE_MOVED_TO_VACANCY || $prj['kind'] == projects::KIND_PERSONAL) { continue; } //Если у фрилансера ответ на проект то не добавляем его в рассылку if (isset($offers_exist[$prj['id']][$user['uid']])) { continue; } if ($prj['pro_only'] == 't') { if ($cnt_pro < $show_pro_limit) { $message_pro .= $prj['html']; ++$cnt_pro; } } else { if ($cnt < $show_limit) { $message .= $prj['html']; ++$cnt; } } ++$cnt_user_submited; } $message = $message_pro . $message; if (empty($message)) { continue; } if ($cnt_user_submited <= $show_pro_limit + $show_limit) { $cnt_submited = $cnt_user_submited; } //Формирует UTM метки аналитики $reg_date = strtotime($user['reg_date']); $reg_year = date('Y', $reg_date); $utm_content = $reg_date >= $strtotime_1w_ago ? '_new' : $reg_year; //$utm_content = ($user['reg_days_ago'] > 7)?$user['reg_date_year']:'_new'; $utm_param = $this->_addUtmUrlParams('email', 'free' . $utm_content, 'day_projects' . $current_date_sufix); $message = str_replace('%UTM_PARAM%', $utm_param, $message); //Собираем шаблон $message = Template::render($_SERVER['DOCUMENT_ROOT'] . '/templates/mail/new_projects/project_list.tpl.php', array('projects' => $message, 'spec_list' => implode(' / ', $subj), 'setup_url' => $GLOBALS['host'] . "/users/{$user['login']}/setup/mailer/", 'other_count' => $cnt_submited - $cnt_pro - $cnt, 'more_url' => $GLOBALS['host'] . $utm_param, 'banner_file' => $banner_file, 'banner_link' => $banner_link)); if (!$user['unsubscribe_key']) { $user['unsubscribe_key'] = users::GetUnsubscribeKey($user['login']); } /* $date = strtotime($projects[0]['post_date']); $date = date( 'j', $date ) . ' ' . monthtostr(date('n', $date),true); */ $projects_count_txt = $cnt_submited . ' ' . plural_form($cnt_submited, array('новый', 'новых', 'новых')) . ' ' . plural_form($cnt_submited, array('проект', 'проекта', 'проектов')); //$title = "{$projects_count_txt} за {$date}"; $last_time = strtotime($user['last_time']); if ($last_time < $strtotime_3y_ago) { $utm_content = '_3y'; } elseif ($last_time >= $strtotime_3y_ago && $last_time <= $strtotime_1y_ago) { $utm_content = '_1-3y'; } elseif ($reg_date < $strtotime_1w_ago) { $utm_content = '_1y'; } /* * @todo: EXTRACT медленней if($user['last_years_ago'] > 0){ $utm_content = ($user['last_years_ago'] > 3)?'_3y':'_1-3y'; }else{ $utm_content = ($user['reg_days_ago'] > 7)?'_1y':'_new'; } */ //Накапливаем статистику $stat_idx = $reg_date >= $strtotime_1w_ago ? 'new' : $reg_year; ++$statistics[$stat_idx]; $this->recipient[] = array('email' => $user['uname'] . ' ' . $user['usurname'] . ' [' . $user['login'] . '] <' . $user['email'] . '>', 'extra' => array('USER_NAME' => $user['uname'], 'USER_SURNAME' => $user['usurname'], 'USER_LOGIN' => $user['login'], 'MESSAGE' => $message, 'UNSUBSCRIBE_URL' => "/unsubscribe/?type=new_projects&ukey={$user['unsubscribe_key']}" . $this->_addUtmUrlParams('email', 'free' . $utm_content, 'unsubscr_day_projects' . $current_date_sufix), 'TITLE' => $projects_count_txt, 'TRACK_URL' => $GLOBALS['host'] . StatisticHelper::track_url(0, $stat_idx, $current_date, $user['login'] . $user['uid']))); ++$count; } $this->bind($massId, true); } //Собранную статистику отправляем в GA $statistics['total'] = $count; $ga = StatisticFactory::getInstance('GA'); $ga->newsletterNewProjectsFrl($statistics, $current_date); return $count; }
echo $budget_price_str; ?> </div> <?php } //if ?> <?php if ($project['cost'] == 0) { ?> <div class="b-post__price-inner">По договоренности</div> <?php } else { ?> <div class="b-post__price-inner"> <?$priceby_str = getPricebyProject($project['priceby']); //if?> <?php echo CurToChar($project['cost'], $project['currency']); echo $priceby_str; ?> <span class="b-post__price-nosik"></span> </div> <?php } //else ?> </div> </td> </tr> </tbody> </table>
<?php $result['name'] = htmlspecialchars($result['name'], ENT_QUOTES, 'CP1251', false); $result['descr'] = htmlspecialchars($result['descr'], ENT_QUOTES, 'CP1251', false); if (!$top_projects) { list($name, $descr) = $element->mark(array((string) $result['name'], (string) $result['descr'])); } else { $name = $result['name']; $descr = $result['descr']; } $priceby_str = getPricebyProject($result['priceby']); if ($result['cost'] == '' || $result['cost'] == 0) { $priceby_str = ""; } $is_top = $result["payed"] && date("Y.m.d H:i") < date("Y.m.d H:i", strtotime($result['top_to'])); if ($result['kind'] == 2 || $result['kind'] == 7) { $result['offers_count'] -= $result['deleted_count']; } ?> <div class="search-lenta-item c <?php echo $result['is_color'] == 't' ? "colored" : ""; ?> "> <span class="number-item"><?php echo $i; ?> .</span> <div class="search-item-body <?php echo $result['is_bold'] == 't' ? "prj-weight" : ""; ?> <?php