本文整理汇总了PHP中projects::GetNewProjectsPreviousDay方法的典型用法代码示例。如果您正苦于以下问题:PHP projects::GetNewProjectsPreviousDay方法的具体用法?PHP projects::GetNewProjectsPreviousDay怎么用?PHP projects::GetNewProjectsPreviousDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects
的用法示例。
在下文中一共展示了projects::GetNewProjectsPreviousDay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NewProj2
/**
* @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;
}
//.........这里部分代码省略.........
示例2: print_r
'some_index_3' => 111,
'some_index_4' => 0,
'some_index_5' => '1',
'some_index_6' => 'ffff',
'some_index_7' => 1.1,
0
);
$user = new users;
$user->UpdateSubscr2(33, $subscr);
print_r(PHP_EOL);
exit;
*/
//------------------------------------------------------------------------------
$result = projects::GetNewProjectsPreviousDay($error, false, 10, true);
var_dump($result);
exit;
//------------------------------------------------------------------------------
/*
exit;
$time_start = microtime(true);
//local
//$users = array(1,2);
//beta