Exemple #1
0
 /**
  * Проверяет, можно ли по данному проекту (таблица projects) начать СБР.
  * Инициализирует $this->projects информацией о проекте.
  * 
  * @param int $project_id ид. проекта.
  *
  * @return array информация о проекте.
  */
 public function checkProject($project_id)
 {
     $project_id = intvalPgSql($project_id);
     if ($this->project && $this->project['id'] == $project_id) {
         return $this->project;
     }
     if ($this->project = new_projects::getPrj($project_id)) {
         if ($this->project['uid'] != $this->uid) {
             $this->error['project_id'] = 'Вы не можете начать «Безопасную Сделку» в чужом проекте';
         } elseif ($this->project['is_blocked'] == 't') {
             $this->error['project_id'] = 'Проект заблокирован! Невозможно начать «Безопасную Сделку» в заблокированном проекте';
         } elseif ($this->project['no_risk'] == 't') {
             // !!! триггер сделать + проверить работает ли флаг в старых СБР
             $this->error['project_id'] = 'Данный проект уже участвует в другой «Безопасной Сделке»';
         } elseif ($this->project['kind'] == 7 && !$this->project['exec_id']) {
             // если создается сделка из конкурса, то обязательно должен быть выбран победитель
             $this->error['project_id'] = 'Сперва нужно выбрать победителя';
         } else {
             if ($this->project['attach'] = projects::getAllAttach($this->project['id'])) {
                 array_walk($this->project['attach'], create_function('&$m, $k', '$m["source_type"] = ' . sbr_stages::ATTACH_SOURCE_PRJ . ';'));
             }
         }
     } else {
         $this->error['project_id'] = 'Проект не найден';
     }
     //print_r($this->error);
     if ($this->error) {
         $this->project = null;
     }
     return $this->project;
 }
 public function getCustomMessage($mes)
 {
     $message = GuestConst::getMessage($mes, GuestConst::TYPE_VACANCY);
     if ($mes == GuestConst::MSG_SUBMIT) {
         $vacancyPrice = new_projects::getProjectInOfficePrice();
         $message = sprintf($message, $vacancyPrice);
     }
     return $message;
 }
 /**
  * Функция автозаполнения полей блока.
  * 
  * @return bool
  */
 public function setFieldAutoComplete()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     $projects = new_projects::getTopProjectBudget(constant(get_class($this) . '::PROJECT_KIND'), $this->getListSize());
     if ($projects) {
         foreach ($projects as $project) {
             $link[] = $GLOBALS['host'] . getFriendlyURL('project', $project['id']);
         }
         $this->initBlock($link);
         return true;
     }
     return false;
 }
Exemple #4
0
function searchProject($string, $categories, $page = 1, $type_loading = 1)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/search/search.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
    $objResponse = new xajaxResponse();
    if (!$string) {
        $string = '';
    }
    $limit_project = 10;
    if ($type_loading == 0) {
        $filter['active'] = 't';
        $filter['my_specs'] = 'f';
        if ($categories[0] != '-1') {
            $filter['categories'][0] = array($categories[0] => '0');
            if ($categories[1] != '-1') {
                unset($filter['categories'][0]);
                $filter['categories'][1] = array($categories[1] => '1');
            }
        }
        $project = new new_projects();
        $project->page_size = $limit_project;
        $projects = $project->getProjects($total, -1, $page, false, $filter, true, false, null, true);
    } else {
        $_SESSION['search_tab_active'] = 'projects';
        $search = new search(false);
        $search->setUserLimit($limit_project);
        $search->addElement('projects', true, $limit_project);
        $filter['active'] = 't';
        $filter['my_specs'] = 'f';
        if ($categories[0] != '-1') {
            $filter['categories'][0] = array($categories[0] => '0');
            if ($categories[1] != '-1') {
                unset($filter['categories'][0]);
                $filter['categories'][1] = array($categories[1] => '1');
            }
        } else {
            $filter['categories'] = null;
        }
        $filter['is_closed_contest'] = true;
        $search->search($string, $page, $filter);
        $element = $search->getElements();
        $total = $element['projects']->total;
        $projects = $element['projects']->results;
    }
    $max_page = ceil($total / $limit_project);
    $next_page = $page + 1;
    if ($projects) {
        if ($page > 1) {
            $dont_show_hint = true;
        }
        ob_start();
        include $_SERVER['DOCUMENT_ROOT'] . '/wizard/registration/steps/tpl.step.search.project.php';
        $html = ob_get_clean();
        $objResponse->script("\$('project_search_hint').show()");
    } else {
        $html = 'Совпадений не найдено';
        $objResponse->script("\$('project_search_hint').hide()");
    }
    if ($next_page > $max_page) {
        $objResponse->script("\$('load_project').getElement('.b-button').addClass('b-button_disabled')");
    } else {
        $objResponse->script("\$('load_project').getElement('.b-button').removeClass('b-button_disabled')");
        $objResponse->assign('page-search', 'value', $next_page);
    }
    if ($page > 1) {
        $objResponse->assign('project_loader_content', 'innerHTML', $html);
        $objResponse->script("var html = new Element('span', {html:\$('project_loader_content').get('html')});\n                              \$('project_content').adopt(html);");
        $objResponse->assign('project_loader_content', 'innerHTML', '');
    } else {
        $objResponse->assign('project_content', 'innerHTML', $html);
    }
    return $objResponse;
}
Exemple #5
0
function getOPProject($from_date = '2000-01-01', $to_date = 'now()', $bYear = false, $bYearAll = false, $ignore_str = '', $addit)
{
    global $DB;
    $query = $select = array();
    $type = $addit['type'];
    $is_konkurs = $addit['is_konkurs'];
    $is_bonus = $addit['is_bonus'];
    if ($ignore_str) {
        //$query[] = "account.uid NOT IN ({$ignore_str})";
        $ignore_str = "INNER JOIN account ON account.id=ac.billing_id AND account.uid NOT IN ({$ignore_str})";
    }
    if ($type !== '') {
        $query[] = "pay_type = {$type}";
        $select[] = "SUM(round(p.ammount,2)) as sum, COUNT(p.*) as ammount ";
        if ($bYear) {
            $to_char = 'MM';
            if ($bYearAll) {
                $to_char = 'YYYY';
            }
            $select[] = "to_char(ac.op_date,'{$to_char}') as _day";
            $group = " GROUP BY to_char(op_date,'{$to_char}') ORDER BY to_char(op_date,'{$to_char}')";
        } else {
            $select[] = "extract(day from ac.op_date) as _day";
            $group = " GROUP BY _day ORDER BY  _day";
        }
    } else {
        if ($is_bonus) {
            $select[] = " SUM(round(ac.bonus_ammount,2)) as sum, COUNT(ac.*) as ammount";
        } else {
            $select[] = " SUM(round(ac.ammount,2)) as sum, COUNT(*) as ammount";
        }
        if ($bYear) {
            $to_char = 'MM';
            if ($bYearAll) {
                $to_char = 'YYYY';
            }
            $select[] = "to_char(op_date,'{$to_char}') as _day";
            $group = " GROUP BY to_char(op_date,'{$to_char}') ORDER BY to_char(op_date,'{$to_char}')";
        } else {
            $select[] = "extract(day from op_date) as _day";
            $group = " GROUP BY _day ORDER BY  _day";
        }
    }
    if ($is_konkurs) {
        $contestOpCodes = new_projects::getContestOpCodes();
        $contestOpCodesSql = implode(',', $contestOpCodes);
        $query[] = "ac.op_code IN ({$contestOpCodesSql}) ";
        if ($is_bonus) {
            $query[] = "ac.bonus_ammount <> 0";
        } else {
            $query[] = "ac.bonus_ammount = 0";
        }
    } else {
        if ($is_bonus) {
            $query[] = "ac.op_code = 54";
        } else {
            $query[] = "ac.op_code IN (8,53)";
        }
    }
    $select_str = implode(", ", $select);
    $query_str = implode(" AND ", $query);
    if ($type === '') {
        $sql = "SELECT \n                    {$select_str}\n                FROM \n                    account_operations as ac \n                    INNER JOIN account ON account.id=ac.billing_id AND NOT (op_date >= '2011-01-01' AND account.uid IN (SELECT uid FROM users WHERE ignore_in_stats = TRUE))\n                WHERE \n                    op_date >= '{$from_date}'::date AND op_date < '{$to_date}'::date+'1 day'::interval AND {$query_str} {$group};";
    } else {
        $sql = "SELECT \n                    {$select_str}\n                FROM projects_payments as p \n                    INNER JOIN projects prj ON prj.id = p.project_id\n                    INNER JOIN account_operations as ac ON p.opid=ac.id \n                    {$ignore_str}\n                    WHERE ac.op_date >= '{$from_date}'::date AND ac.op_date < '{$to_date}'::date+'1 day'::interval AND {$query_str} {$group};";
    }
    return $DB->rows($sql);
}
/**
 * Перемещает проект в вакансии
 * @global type $user_content
 * @param type $sid
 * @return \xajaxResponse
 */
function makeVacancy($stream_id = '', $sid = '')
{
    global $user_content;
    $objResponse = new xajaxResponse();
    list($content_id, $rec_id, $rec_type) = explode('_', $sid);
    if ($user_content->hasContentPermissions($content_id)) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smtp.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/template.php';
        $project = new_projects::initData(new_projects::getPrj($rec_id));
        if ($project->isAllowMovedToVacancy()) {
            // Делаем проект вакансией
            $project->movedToVacancy();
            $user_content->markProjectBlocked($stream_id, $rec_id);
            // Отсылаем письмо заказчику о переносе его проекта в раздел вакансии
            $mail = new smtp();
            $mail->subject = 'Ваш проект перенесен в раздел Вакансии и ожидает публикации';
            // заголовок письма
            $mail->message = Template::render($_SERVER['DOCUMENT_ROOT'] . '/templates/mail/projects/makevacancy.tpl.php', array('title' => $project->_project['name'], 'project_id' => $project->_project['id']));
            $mail->recipient = "{$project->_project['email']} <{$project->_project['email']}>";
            // получатель
            $mail->SmtpMail('text/html');
        }
        $objResponse->script('user_content.spinner.hide(true);');
        $objResponse->script("\$('my_div_content_{$sid}').destroy();");
        $objResponse->script('user_content.spinner.resize();');
    } else {
        _parsePermissionsDenied($objResponse);
    }
    return $objResponse;
}
Exemple #7
0
        
        <div class="b-layout <?php 
if (!(isset($project) && isset($project['payed']) && $project['payed'] > 0) || $project['is_pro'] === 't') {
    ?>
b-layout_margright_270 b-layout_marg_null_ipad<?php 
}
?>
"><?php 
include "tpl.prj-main.php";
?>
</div>
        
<?php 
if (!isset($uid) || $uid <= 0) {
    //Выводим список схожих проектов/ваканси/конкурсов
    $prj = new new_projects();
    $prj_content = $prj->getSimilarProjects($project['id'], 5, $project_specs);
    if ($prj_content) {
        //Список специализаций через запятую
        $str_specs = projects::getGroupLinks($project_specs);
        ?>
        <div class="b-layout b-layout_margright_270 b-layout_marg_null_ipad">
            <h3 class="b-layout__title b-layout__title_padbot_20">
                <?php 
        if ($str_specs) {
            ?>
                    Другие проекты по <?php 
            echo ending(count($project_specs), 'специализации', 'специализациям', 'специализациям');
            ?>
 
                    &laquo;<?php 
Exemple #8
0
 /**
  * Взять данные для истории по периоду (новый личный счет)
  *
  * @see  class page_bill
  * 
  * @param string  $sdate 	Дата начало периода
  * @param string  $edate 	Дата окончание периода
  * @param integer $sort  	Тип сортировки (1,2 - сортировка по дате; 3,4 - сортировка по коду операции (op_codes); 5,6 - сортировка по сумме) по умолчанию сортировка по дате
  * @param string  $type  	Доп переменная для фильтровки результатов, по умолчанию false @see page_bill::historyAction() 
  * @param integer $page  	Страница выборки
  * @param integer $pages 	Возвращает количество страниц 
  * @param integer $total 	Возвращает количество данных выборки
  * @param integer $count 	Число показа данных на странице
  * @return array 			Данные выборки
  */
 function searchBillHistory($sdate, $edate, $sort, $type = false, $page = 1, &$pages, &$total, $count = 10)
 {
     global $DB;
     $uid = get_uid(false);
     switch ($sort) {
         case 1:
             $sort = "op_date DESC";
             break;
         case 2:
             $sort = "op_date ASC";
             break;
         case 3:
             $sort = "op_code DESC";
             break;
         case 4:
             $sort = "op_code ASC";
         case 5:
             $sort = "ammount DESC";
             break;
         case 6:
             $sort = "ammount ASC";
             break;
         default:
             $sort = "op_date DESC";
             break;
     }
     $page--;
     if ($page < 0) {
         $page = 0;
     }
     $page_sql = $page * $count;
     $limit = $count ? "LIMIT {$count} OFFSET {$page_sql}" : '';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     $opCodes = new_projects::getContestOpCodes();
     $opCodesSql = implode(',', $opCodes);
     // op_code <> 77 СБР не выводим тк деньги через ЛС не проходят #0020554
     $sql = "SELECT op_date, op_name, ammount, comments, op_code, account_operations.id, round(balance,2) as balance, trs_sum, payment_sys, p.id as project_id\n                FROM account_operations\n\t\t\t\tLEFT JOIN account ON account.id=account_operations.billing_id\n\t\t\t\tLEFT JOIN op_codes on op_code=op_codes.id LEFT JOIN account_operations_blocked ob ON ob.operation_id = account_operations.id \n                LEFT JOIN projects p\n                    ON op_code IN ({$opCodesSql}) AND account_operations.id = p.billing_id\n                WHERE ( op_code IN (" . sbr::OP_RESERVE . ", " . sbr::OP_CREDIT . ", " . sbr::OP_DEBIT . ") AND ammount = 0 ) = false AND  ob.id IS NULL AND uid='{$uid}' AND op_date <= '" . date('c', $edate) . "' AND op_date >= '" . date('c', $sdate) . "' " . ($type != false ? $type : '') . " ORDER BY {$sort} {$limit}";
     $sql_total_page = "SELECT COUNT(*) as total FROM account_operations LEFT JOIN account ON account.id=account_operations.billing_id LEFT JOIN op_codes on op_code=op_codes.id \n                            WHERE ( op_code IN (" . sbr::OP_RESERVE . ", " . sbr::OP_CREDIT . ", " . sbr::OP_DEBIT . ") AND ammount = 0 ) = false AND uid='{$uid}' AND op_date <= '" . date('c', $edate) . "' AND op_date >= '" . date('c', $sdate) . "' " . ($type != false ? $type : '');
     $total = $DB->val($sql_total_page);
     $pages = $count ? ceil($total / $count) : 1;
     /*} else {
     			$sql = "SELECT op_date, op_name, ammount, comments, op_code, account_operations.id FROM account_operations
     				LEFT JOIN account ON account.id=account_operations.billing_id
     				LEFT JOIN op_codes on op_code=op_codes.id WHERE uid='$uid' AND op_date <= '".date('c', $edate)."' AND op_date >= '".date('c', $sdate)."' AND op_code IN(".implode(",", $type).") ORDER BY $sort";
     		}*/
     //echo $sql;
     return $DB->rows($sql);
 }
Exemple #9
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/config.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
new_projects::indeedGenerateRss('upload/indeed.xml');
Exemple #10
0
         $_POST['pf_country'] = intval($_POST['pf_country']);
         $_POST['pf_city'] = intval($_POST['pf_city']);
         $filter = array("active" => "t", "cost_from" => $_POST['pf_cost_from'], "cost_to" => $_POST['pf_cost_to'], "currency" => $_POST['pf_currency'], "wo_cost" => $_POST['pf_wo_budjet'] == 1 ? 't' : 'f', "only_sbr" => $_POST['pf_only_sbr'] == 1 ? 't' : 'f', "category" => $_POST['pf_category'], "my_specs" => $_POST['pf_my_specs'] == 1 ? 't' : 'f', "categories" => $_POST['pf_categofy'], "country" => (int) $_POST['pf_country'], "city" => (int) $_POST['pf_city']);
         if ($filter['my_specs'] == 't') {
             $filter['user_specs'] = $user_specs;
         }
         $_SESSION['search_advanced'][$type] = $filter;
     } elseif ($_POST['action'] == "search") {
         unset($_SESSION['search_advanced'][$type]);
     }
     // вывод по-умолчанию последних N (в зависимости от выбранного значения) проектов #0019045
     $top_projects = null;
     $top_projects_cnt = null;
     if (get_uid(0) && !is_emp() && !isset($_POST['search_string'])) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
         $prj = new new_projects();
         $prj->page_size = $set_usr_limit;
         $top_projects = $prj->getLastProjects(5, null, $set_usr_limit);
         $top_projects_cnt = count($top_projects);
     }
     break;
 case "works":
 case "messages":
 case "commune":
     //case "blogs":
 //case "blogs":
 case "notes":
     //case "articles":
     $search_tabs[$type]['active'] = true;
     if (!isset($_SESSION['search_elms']['notes'])) {
         $_SESSION['search_elms'] = array('works' => 0, 'messages' => 0, 'commune' => 0, 'notes' => 0);
<?php

/**
 * П-1, П-2 (При подтверждении публикации вакансии зарегистрированным работодателем)
 */
/**
 * Тема письма
 */
$smail->subject = "Подтверждение публикации вакансии на сайте FL.ru";
$activate_url = sprintf("%s/guest/activate/%s/", $GLOBALS['host'], $code);
$pro_url = $GLOBALS['host'] . '/payed-emp/';
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
$vacancy_price = new_projects::getProjectInOfficePrice($is_pro);
$vacancy_price_pro = new_projects::getProjectInOfficePrice(true);
?>
Вы получили это письмо, т.к. ваш e-mail адрес был указан на сайте FL.ru при размещении новой вакансии.

Чтобы завершить процесс и опубликовать вакансию за <?php 
echo $vacancy_price;
?>
 рублей, пожалуйста, перейдите по ссылке <a href="<?php 
echo $activate_url;
?>
"><?php 
echo $activate_url;
?>
</a> или скопируйте ее в адресную строку браузера.

<?php 
if (!$is_pro) {
    ?>
 /**
  * Проверяет по специализациям, может ли текущий пользователь ответить на проект.
  * 
  * @param int $projec_id ид проекта
  *
  * @return boolean
  */
 public static function offerSpecIsAllowed($projec_id)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     // ПРО отвечают без ограничений
     if (is_pro()) {
         return true;
     }
     if (!get_uid(false)) {
         return false;
     }
     $is_send_offers = false;
     $spec_project = new_projects::getSpecs($projec_id);
     $user_spec = professions::GetProfsAddSpec($_SESSION['uid']);
     if (is_array($user_spec)) {
         $user_spec = array_merge($user_spec, $_SESSION['specs']);
     } else {
         $user_spec = $_SESSION['specs'];
     }
     if ($user_spec) {
         $user_spec = array_merge($user_spec, professions::GetMirroredProfs(professions::GetProfessionOrigin(implode(',', $user_spec))));
         $user_spec = array_unique($user_spec);
         //@todo запехать в один запрос
         foreach ($user_spec as $spec) {
             $prof_group[$spec] = professions::GetProfField($spec, 'prof_group');
         }
     }
     foreach ($spec_project as $specs) {
         if (is_array($prof_group) && in_array($specs['category_id'], $prof_group)) {
             $is_send_offers = true;
             // Разрашаем оставлять отзыв
             break;
         }
     }
     return $is_send_offers;
 }
Exemple #13
0
<?php

ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
require_once '../classes/config.php';
require_once '../classes/projects.php';
new_projects::jobradioGenerateRss('upload/jobradio.xml');
Exemple #14
0
 /**
  * Возвращает ленту проектов.
  * 
  * @param int   $kind      тип проектов (-1=5=Все проекты; 2=Конкурсы; 4=В офис; 6=Только для про)
  * @param array $filter    массив с фильтром проектов (тот же, что для projects::getProjects(), но разделы в таком виде: [[1,2,3], [44,55,66]], где по индексу 0 -- разделы, по 1 -- подразделы)
  * @param int   $page_size кол-во проектов на странице.
  *
  * @return array
  */
 protected function x____getProjects($args)
 {
     list($kind, $filter, $page_size) = $args;
     require_once ABS_PATH . '/classes/projects.php';
     require_once ABS_PATH . '/classes/projects_filter.php';
     require_once ABS_PATH . '/classes/professions.php';
     $result = null;
     $projects = new new_projects();
     $kind = $kind ? (int) $kind : $this->_mCfg['default_kind'];
     $page_size = (int) $page_size;
     $limit = $page_size > $this->_mCfg['max_page_size'] ? $this->_mCfg['max_page_size'] : ($page_size < $this->_mCfg['min_page_size'] ? $this->_mCfg['page_size'] : $page_size);
     if ($filter) {
         $filter['active'] = $this->ex2pg(EXTERNAL_TRUE, EXTERNAL_DT_BOOL);
         $filter['wo_cost'] = $this->ex2pg($filter['wo_cost'], EXTERNAL_DT_BOOL);
         $filter['only_sbr'] = $this->ex2pg($filter['prefer_sbr'], EXTERNAL_DT_BOOL);
         if ($filter['my_specs']) {
             $filter['my_specs'] = $this->ex2pg($filter['my_specs'], EXTERNAL_DT_BOOL);
             $filter['user_specs'] = professions::GetProfessionsByUser($this->_sess->_uid, false, true);
         }
         if (isset($filter['categories']) && is_array($filter['categories'])) {
             $filter['categories'] = intarrPgSql($filter['categories']);
             $cats = $filter['categories'];
             $filter['categories'] = array();
             foreach ($cats as $i => $arr) {
                 if ($i > 1) {
                     break;
                 }
                 if (is_array($arr) && !isNulArray($arr)) {
                     if ($i == 1) {
                         $arr = professions::GetMirroredProfs(implode(',', $arr));
                     }
                     $filter['categories'][$i] = array_fill_keys($arr, $i);
                 }
             }
         }
         list($filter['cost_from'], $filter['cost_to']) = projects_filters::preCosts($filter['cost_from'], $filter['cost_to']);
     }
     if ($prjs = $projects->getLastProjects($kind, $filter, $limit, true)) {
         foreach ($prjs as $key => $p) {
             $row = $this->pg2exRow($this->_mCfg['fields'], $p);
             if ($row['logo']) {
                 $row['logo'] = WDCPREFIX . '/' . $row['logo'];
             }
             if ($attach = $projects->getAllAttach($p['id'])) {
                 $row['attach'] = array();
                 foreach ($attach as $a) {
                     $att = $this->pg2exRow($this->_mCfg['attach-fields'], $a);
                     $att['link'] = WDCPREFIX . '/' . $a['path'] . $a['name'];
                     $row['attach'][] = $att;
                 }
             }
             $result[$key] = $row;
         }
     }
     return $result;
 }
Exemple #15
0
<?php

ini_set("memory_limit", "512M");
$_SERVER['DOCUMENT_ROOT'] = realpath(dirname(__FILE__) . '/../');
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/config.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
new_projects::joobleGenerateRss('upload/jooble.xml', '24 hours');
Exemple #16
0
    case 4:
        $kindStr = 'В офис';
        break;
    case 6:
        $kindStr = 'Проекты для PRO';
        break;
    default:
        $kindStr = 'Все проекты';
        $kind = 5;
        break;
}
if (!$subcategory) {
    $subcategory = 0;
}
$mbkey = $subcategory ? ($category ? $category . '_' : '') . 'sub_' . $subcategory : $category;
$projects = new new_projects();
$projects->setPageSize(new_projects::PAGE_SIZE_RSS);
$getcnt = 'nenado';
$additional = $subcategory ? array('active' => 't', 'categories' => array(array(), array($subcategory => 1))) : ($category ? array('active' => 't', 'categories' => array(array($category => 1))) : null);
$prjs = $projects->getProjects($getcnt, (int) $kind, 1, false, $additional);
if ($subcategory) {
    $kindStr .= ': ' . professions::GetProfNameWP($subcategory, ' - ', 'Все разделы', false);
} elseif ($category) {
    $name_cat = professions::GetGroup($category, $error);
    $kindStr .= ': ' . $name_cat['name'];
}
header('Content-Type: application/rss+xml');
print '<?xml version="1.0" encoding="windows-1251"?>';
?>
<!--  RSS generated by FL.ru RSS Generator on <?php 
echo gmdate('D, d M Y H:i:s');
Exemple #17
0
<form action="/public/" method="POST" enctype="multipart/form-data" id="publicForm" onsubmit="ge('freeBtn').disabled=true;ge('payBtn').disabled=true">
  <h3 id="ptype"><?php 
echo $project['payed'] || $tmpPrj->isKonkurs() || $price || $project['kind'] == 4 ? 'Платное' : 'Бесплатное';
?>
 объявление<?php 
echo $tmpPrj->isKonkurs() ? ' (конкурс)' : '';
?>
</h3>
  <div class="app-left">
    <p>У платных объявлений на порядок <br />больше просмотров и ответов.<br /> Обычно фрилансеры воспринимают <br />платное объявление более серьезно.</p>
    <ul class="apf-list app-list">
        <li <?php 
echo $project['kind'] == 7 || $project['kind'] == 4 && is_pro() == false ? '' : 'style="display: none;"';
?>
><input type="checkbox" name="public" value="1" id="public" disabled="disabled" checked="checked" /> <label for="public">Публикация проекта &mdash; <?php 
echo round($project['kind'] == 4 ? new_projects::getProjectInOfficePrice() : new_projects::getKonkursPrice());
?>
 руб.</label></li>
        <li>
          <input type="checkbox" id="f4" name="top_ok" value="1" onchange="oktop(this)"<?php 
echo ($remTPeriod || $addedTD ? ' checked' : '') . ($remTPeriod ? ' disabled' : '');
?>
/>
          <label for="f4" class="clip">Закрепить наверху ленты</label>
          <p class="app-dayes">
            <?php 
if (!$remTPeriod) {
    ?>
              на <input type="text" size="2" onmousewheel="cibywheel(this,0,365);addtop(this,<?php 
    echo $addedTD ? $addedTD : 1;
    ?>
        </a>&#160;&#160;
        <a href="javascript:void(0)" class="b-button b-button_rectangle_color_transparent b-button_toggle  <?php 
echo $data['kind'] == 7 ? 'b-button_active' : '';
?>
" onclick="setTypeProject(1)">
            <span class="b-button__b1">
                <span class="b-button__b2 b-button__b2_padlr_10">
                    <span class="b-button__txt">Добавить конкурс</span>
                </span>
            </span>
        </a>
    </div>
    <div class="b-layout__txt b-layout__txt_padbot_15 project-elm"><span class="b-layout__bold">Проект</span> предполагает разовое задание, которое может быть выполнено удаленно. В описании проекта необходимо максимально подробно описать суть задачи, а еще лучше – приложить детальное техзадание (ТЗ) на выполнение работы.</div>
    <div class="b-layout__txt b-layout__txt_padbot_15 b-layout_hide contest-elm">Создайте <span class="b-layout__bold">конкурс</span>, если хотите выбрать лучшего исполнителя по результатам выполнения тестового задания. В описании конкурса нужно указать суть тестовой задачи, условия проведения конкурса и критерии выбора победителя.</div>
    <div class="b-layout__txt b-layout__txt_padbot_10 b-layout_hide contest-elm">Публикация конкурса платная &mdash; <span class="b-layout__txt b-layout__txt_bold b-layout__txt_color_fd6c30"><?php 
echo new_projects::getKonkursPrice();
?>
 рублей</span></div>
    <div class="b-check b-check_padtop_3 b-check_padbot_20 project-elm">
        <input id="in_office" class="b-check__input" name="in_office" type="checkbox" value="1" <?php 
echo $data['kind'] == 4 ? "checked='checked'" : '';
?>
/>
        <label for="in_office" class="b-check__label b-check__label_fontsize_13">Исполнитель нужен для работы в офисе</label>
    </div>
    <?php 
if ($error['project']) {
    ?>
    <div class="b-layout__txt b-layout__txt_color_c4271f b-layout__txt_padbot_10">
        <span class="b-form__error"></span> <?php 
    echo $error['project'];
Exemple #19
0
/**
 * формирует превью проекта на главной странице.
 */
function GetPreview($data)
{
    $objResponse = new xajaxResponse();
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/CFile.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/HTML/projects_lenta.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/memBuff2.php';
    $kind = 1;
    $memBuff = new memBuff();
    $htmlLenta = $memBuff->get('projectsLentaHTML');
    if (!$htmlLenta) {
        $prj = new new_projects();
        $prjs = $prj->getProjects($num_prjs, -1, 1, false, null, true);
        foreach ($prjs as &$proj) {
            // стираем принадлежность проекта к пользователю, чтобы не появилось кнопок РЕДАКТИРОВАТЬ и пр.
            unset($proj['user_id']);
        }
        unset($proj);
        $htmlPrj = new HTMLProjects();
        $htmlPrj->template = '/projects/tpl.lenta.new.php';
        $prj_content = $htmlPrj->ShowProjects($num_prjs, $prjs, 1, 1, null, true);
        $prfs = new professions();
        $profs = $prfs->GetAllProfessions('', 0, 1);
        // подложка с лентой проектов
        ob_start();
        include $_SERVER['DOCUMENT_ROOT'] . '/templates/main.php';
        $htmlLenta = ob_get_clean();
        // кэшируем ленту проектов
        $memBuff->set('projectsLentaHTML', $htmlLenta, 1800);
    }
    // подготавливаем данные для шаблона в ленту проектов
    $row = array();
    $row['kind'] = __paramValue('int', $data['kind']);
    $row['cost'] = __paramValue('int', $data['cost']);
    $row['currency'] = __paramValue('int', $data['currency_db_id']);
    $row['priceby'] = __paramValue('int', $data['priceby_db_id']);
    $row['name'] = stripslashes(__paramValue('html', $data['name'], null, true));
    $contacts = array('phone' => array('name' => 'Телефон', 'value' => ''), 'site' => array('name' => 'Сайт', 'value' => ''), 'icq' => array('name' => 'ICQ', 'value' => ''), 'skype' => array('name' => 'Skype', 'value' => ''), 'email' => array('name' => 'E-mail', 'value' => ''));
    if (isset($data['contacts'])) {
        foreach ($data['contacts'] as $name => $value) {
            if (!isset($contacts[$name])) {
                continue;
            }
            switch ($name) {
                case 'site':
                    if (!url_validate(ltrim(ltrim($value, 'http://'), 'https://')) && trim($value) != '') {
                        $error["contact_{$name}"] = 'Поле заполнено некорректно';
                    }
                    if (strpos($value, 'htt') === false && trim($value) != '') {
                        $value = 'http://' . $value;
                    }
                    break;
                case 'email':
                    if (!is_email($value) && trim($value) != '') {
                        $error["contact_{$name}"] = 'Поле заполнено некорректно';
                    }
                    break;
            }
            $contacts[$name]['value'] = __paramValue('htmltext', stripslashes($value));
        }
        $row['contacts'] = serialize($contacts);
    }
    $descrFull = stripslashes(__paramValue('html', $data['descr'], null, true));
    $descr = preg_replace('/^ /', "", $descrFull);
    $descr = preg_replace("/(\n) /", "\$1", $descr);
    $descr = reformat(strip_tags(htmlspecialchars(LenghtFormatEx(htmlspecialchars_decode($descr, ENT_QUOTES), 180), ENT_QUOTES), '<br />'), 50, 1, 0, 1);
    $descr = preg_replace("//", '&nbsp;', $descr);
    $row['descr'] = $descr;
    $row['t_is_payed'] = $data['logo_ok'] || $data['top_ok'];
    $row['t_is_ontop'] = __paramValue('bool', $data['top_ok']);
    $row['t_pro_only'] = $data['pro_only'] ? 't' : 'f';
    $row['t_verify_only'] = $data['verify_only'] ? 't' : 'f';
    $row['t_urgent'] = $data['urgent'] ? 't' : 'f';
    $row['t_hide'] = $data['hide'] ? 't' : 'f';
    $row['create_date'] = date('Y-m-d H:i', strtotime(date('Y-m-d H:i:s')) - 120);
    // делаем дату публикации 2 минуты назад
    $row['end_date'] = __paramValue('string', $data['end_date']);
    $row['win_date'] = __paramValue('string', $data['win_date']);
    $row['country'] = __paramValue('int', $data['project_location_columns'][0]);
    $row['city'] = __paramValue('int', $data['project_location_columns'][1]);
    list($row['country_name'], $row['city_name']) = explode(': ', __paramValue('string', $data['location']));
    $logoOK = __paramValue('bool', $data['logo_ok']);
    $topOK = __paramValue('bool', $data['top_ok']);
    $row['link'] = __paramValue('string', $data['link']);
    if ($logoOK) {
        $logoAttach = new attachedfiles($data['logo_attachedfiles_session']);
        $logoFiles = $logoAttach->getFiles(array(1));
        if (count($logoFiles)) {
            $logoFile = array_pop($logoFiles);
            // загружено может быть несколько файлов, берем последний
            $logoCFile = new CFile($logoFile['id']);
        } elseif (__paramValue('int', $data['logo_file_id'])) {
            $logoCFile = new CFile(__paramValue('int', $data['logo_file_id']));
        }
        $row['logo_name'] = $logoCFile->name;
        $row['logo_path'] = $logoCFile->path;
    }
    $is_ajax = true;
    // подготовка данных для подробной страницы проекта
    $project = $row;
    $categories = array();
    for ($i = 0; $i < 3; ++$i) {
        $categoryID = __paramValue('int', $data['project_profession' . $i . '_columns'][0]);
        $subcategoryID = __paramValue('int', $data['project_profession' . $i . '_spec_columns'][0]);
        if ($categoryID || $subcategoryID) {
            $categories[] = array('category_id' => $categoryID, 'subcategory_id' => $subcategoryID);
        }
    }
    $project['spec_txt'] = projects::_getSpecsStr($categories, ' / ', ', ', true);
    $project['ico_payed'] = $logoOK;
    $project['is_upped'] = $topOK;
    $project['descr'] = $descrFull;
    $project['logo_id'] = $logoCFile->id;
    $project['prefer_sbr'] = __paramValue('bool', $data['prefer_sbr']) ? 't' : 'f';
    $project['urgent'] = __paramValue('bool', $data['urgent']) ? 't' : 'f';
    $project['hide'] = __paramValue('bool', $data['hide']) ? 't' : 'f';
    if (trim($project['contacts']) != '') {
        $contacts_employer = unserialize($project['contacts']);
        $empty_contacts_employer = 0;
        foreach ($contacts_employer as $name => $contact) {
            if (trim($contact['value']) == '') {
                $empty_contacts_employer++;
            }
        }
        $is_contacts_employer_empty = count($contacts_employer) == $empty_contacts_employer;
    }
    $isPreview = true;
    $project_exRates = project_exrates::GetAll();
    $translate_exRates = array(0 => 2, 1 => 3, 2 => 4, 3 => 1);
    ob_start();
    include $_SERVER['DOCUMENT_ROOT'] . '/public/new/tpl.preview.php';
    ?>
    <?php 
    $htmlProject = ob_get_clean();
    $objResponse->assign('project_preview_lenta', 'innerHTML', $htmlLenta);
    $objResponse->assign('project_preview_content', 'innerHTML', $htmlProject);
    $objResponse->script('Public.showPreview()');
    return $objResponse;
}
Exemple #20
0
<?php

$up_price = array('prj' => new_projects::getPriceByCode(is_pro() ? new_projects::OPCODE_UP : new_projects::OPCODE_UP_NOPRO), 'prjtop' => new_projects::getPriceByCode(is_pro() ? new_projects::OPCODE_TOP : new_projects::OPCODE_TOP_NOPRO));
?>


 
 
                        
<table class="b-layout__table b-layout__table_width_full b-layout__table_bordbot_df b-layout__table_2bordtop_df b-layout__table_margbot_20">
   <tr class="b-layout__tr">
      <td class="b-layout__td b-layout__td_width_60 b-layout__td_padtb_10 b-layout__td_ipad">
          <?php 
if ($show_info) {
    ?>
              <?php 
    echo view_avatar($project['login'], $project['photo']);
    ?>
          <?php 
} else {
    //if
    ?>
              <img src="/images/user-default-small.png" alt="" width="50" height="50" class="lpl-avatar">
          <?php 
}
//else
?>
      </td>
      <td class="b-layout__td b-layout__td_padtb_10 b-layout__td_ipad">
          <div class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_bold b-layout__txt_padbot_5">
                  <?php 
 /**
  * Обработка и оплата операций
  * 
  * @global type $DB
  * @param type $option
  * @return boolean 
  */
 function billingOperation($option, $transaction_id)
 {
     global $DB;
     $ok = false;
     $account = new account();
     switch ($option['op_code']) {
         // Аккаунт ПРО у фрилансера
         case 48:
         case 49:
         case 50:
         case 51:
         case 76:
             // Удаляем операции по покупке ответов - публикуем ответы
             $prof = new payed();
             $ok = $prof->SetOrderedTarif($this->uid, $transaction_id, 1, "Аккаунт PRO", $option['op_code'], $error);
             if ($ok) {
                 $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
                 $_SESSION['pro_last'] = $_SESSION['pro_last']['freeze_to'] ? false : $_SESSION['pro_last']['cnt'];
                 $userdata = new users();
                 $_SESSION['pro_test'] = $userdata->GetField($this->uid, $error2, 'is_pro_test', false);
                 $this->clearBlockedOperations(step_freelancer::OFFERS_OP_CODE);
                 $step_frl = new step_freelancer();
                 $offers = $step_frl->getWizardOffers($this->uid, 'all', false);
                 if ($offers) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
                     $step_frl->log = $this->log;
                     $step_frl->user = new users();
                     $step_frl->user->GetUserByUID($this->uid);
                     $step_frl->transferOffers($offers);
                 }
                 $this->showProjectsFeedbacks();
             }
             break;
             // Аккаунт ПРО у работодателя
         // Аккаунт ПРО у работодателя
         case 15:
             $prof = new payed();
             $ok = $prof->SetOrderedTarif($this->uid, $transaction_id, 1, "Аккаунт PRO", $option['op_code'], $error);
             if ($ok) {
                 $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
                 $_SESSION['pro_last'] = $_SESSION['pro_last']['freeze_to'] ? false : $_SESSION['pro_last']['cnt'];
                 $userdata = new users();
                 $_SESSION['pro_test'] = $userdata->GetField($this->uid, $error2, 'is_pro_test', false);
             }
             // Обновляем выбор цвета для проектов тк он для ПРО бесплатный
             $colorProjects = $this->updateColorProject();
             $prj = new new_projects();
             foreach ($colorProjects as $k => $project) {
                 $delete_color[] = $project['op_id'];
                 if ($project['country'] == null) {
                     $project['country'] = 'null';
                 }
                 if ($project['city'] == null) {
                     $project['city'] = 'null';
                 }
                 $project['name'] = addslashes($project['name']);
                 $project['descr'] = addslashes($project['descr']);
                 if ($project['logo_id'] <= 0) {
                     $project['logo_id'] = 'null';
                 }
                 $project['payed_items'] = $project['payed_items'] | '010';
                 $project['is_color'] = 't';
                 $prj->editPrj($project, false);
             }
             // Удаляем данные операции
             if ($delete_color) {
                 $this->deleteDraftAccountOperation($delete_color);
             }
             break;
             // Публикация конкурса
         // Публикация конкурса
         case new_projects::OPCODE_KON:
         case new_projects::OPCODE_KON_NOPRO:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_wizard_registration.php';
             $drafts = new drafts();
             $draft = $drafts->getDraft($option['parent_id'], $this->uid, 1);
             // Если еще не опубликован
             if (!$draft['prj_id']) {
                 $project_id = $draft['id'];
                 $error = $account->Buy($bill_id, $transaction_id, $option['op_code'], $this->uid, $option['descr'], $option['comment'], 1, 0);
                 $ok = $bill_id > 0;
                 if ($bill_id) {
                     $color = $DB->val("SELECT id FROM draft_account_operations WHERE parent_id = ? AND op_type = 'contest' AND option = 'color' AND uid = ?", $project_id, wizard::getUserIDReg());
                     $draft['billing_id'] = $bill_id;
                     $draft['folder_id'] = 'null';
                     $draft['payed'] = '0';
                     $draft['payed_items'] = '000';
                     if (is_pro() && $color > 0) {
                         $draft['is_color'] = 't';
                     } else {
                         $draft['is_color'] = 'f';
                     }
                     $draft['win_date'] = date('d-m-Y', strtotime($draft['win_date']));
                     $draft['end_date'] = date('d-m-Y', strtotime($draft['end_date']));
                     $draft['is_bold'] = 'f';
                     $draft['user_id'] = $this->uid;
                     if ($draft['country'] == null) {
                         $draft['country'] = 'null';
                     }
                     if ($draft['city'] == null) {
                         $draft['city'] = 'null';
                     }
                     $draft['name'] = addslashes($draft['name']);
                     $draft['descr'] = addslashes($draft['descr']);
                     if ($draft['logo_id'] <= 0) {
                         $draft['logo_id'] = 'null';
                     }
                     $prj = new new_projects();
                     $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($option['parent_id'], 4);
                     if ($attachedfiles_tmpdraft_files) {
                         $attachedfiles_tmpdraft_files = array_map(create_function('$a', 'return array("id" => $a);'), $attachedfiles_tmpdraft_files);
                     }
                     if ($attachedfiles_tmpdraft_files) {
                         $month = date('Ym');
                         $dir = 'projects/upload/' . $month . '/';
                         $files = step_wizard_registration::transferFiles($attachedfiles_tmpdraft_files, 'file_projects', $dir);
                     }
                     $spec = $draft["categories"];
                     $spec = explode("|", $spec);
                     $spec = array(array('category_id' => $spec[0], 'subcategory_id' => $spec[1]));
                     $prj->addPrj($draft, $files);
                     $prj->saveSpecs($draft["id"], $spec);
                     // смотрим были ли выбраны платные опции для опубликованного конкурса
                     if ($draft['id'] != $project_id && $draft['id'] > 0) {
                         if ($this->sleep[$project_id]) {
                             foreach ($this->sleep[$project_id] as $k => $opt) {
                                 $opt['parent_id'] = $draft['id'];
                                 $this->billingOperation($opt);
                             }
                         } else {
                             //Обновляем родителя на всякий случай
                             $update = array("parent_id" => $draft['id']);
                             $DB->update("draft_account_operations", $update, "parent_id = ? AND op_type = 'contest' AND uid = ?", $project_id, wizard::getUserIDReg());
                             $this->sleep_parent[$project_id] = $draft['id'];
                         }
                         $DB->update("draft_projects", array('prj_id' => $draft['id']), "id = ? AND uid = ?", $project_id, wizard::getUserIDReg());
                     }
                 }
             }
             break;
             // Платный проект/конкурс
         // Платный проект/конкурс
         case 53:
             $prj = new new_projects();
             if ($this->sleep_parent[$option['parent_id']]) {
                 $option['parent_id'] = $this->sleep_parent[$option['parent_id']];
             }
             $project = $prj->getProject($option['parent_id']);
             if (!$project['id']) {
                 $this->sleep[$option['parent_id']][$option['id']] = $option;
                 return true;
             } else {
                 unset($this->sleep[$option['parent_id']]);
             }
             if ($project['country'] == null) {
                 $project['country'] = 'null';
             }
             if ($project['city'] == null) {
                 $project['city'] = 'null';
             }
             $project['name'] = addslashes($project['name']);
             $project['descr'] = addslashes($project['descr']);
             if ($project['logo_id'] <= 0) {
                 $project['logo_id'] = 'null';
             }
             $project['folder_id'] = 'null';
             $items = array();
             switch ($option['option']) {
                 case 'top':
                     $project['top_days'] = $option['op_count'];
                     break;
                 case 'color':
                     $is_pay = $project['payed_items'] & '010';
                     if ($is_pay != '010') {
                         $project['payed_items'] = $project['payed_items'] | '010';
                         $project['is_color'] = 't';
                         $items['color'] = true;
                         if (is_pro()) {
                             $is_payed = true;
                             $prj->SavePayedInfo($items, $project['id'], null, $project['top_days']);
                             $prj->editPrj($project, false);
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'bold':
                     $is_pay = $project['payed_items'] & '001';
                     if ($is_pay != '001') {
                         $project['payed_items'] = $project['payed_items'] | '001';
                         $project['is_bold'] = 't';
                         $items['bold'] = true;
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'logo':
                     $is_pay = $project['payed_items'] & '100';
                     if ($is_pay != '100') {
                         $key = md5(microtime());
                         $prj = new tmp_project($key);
                         $prj->init(1);
                         $fu = new CFile($option['src_id']);
                         $ext = $fu->getext();
                         $tmp_dir = $prj->getDstAbsDir();
                         $tmp_name = $fu->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                         $fu->table = 'file_projects';
                         $r = $fu->_remoteCopy($tmp_dir . $tmp_name);
                         $project['payed_items'] = $project['payed_items'] | '100';
                         $project['logo_id'] = $fu->id;
                         $items['logo'] = true;
                         if ($option['extra']) {
                             $project['link'] = $option['extra'];
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
             }
             if (!$is_payed) {
                 $error = $account->Buy($bill_id, $transaction_id, $option['op_code'], $this->uid, $option['descr'], $option['comment'], $option['ammount'], 0);
                 $ok = $bill_id > 0;
                 $project['billing_id'] = $bill_id;
                 $prj->SavePayedInfo($items, $project['id'], $bill_id, $project['top_days']);
                 $prj->editPrj($project, false);
             } else {
                 $ok = true;
             }
             break;
             // Платные ответы на проекты
         // Платные ответы на проекты
         case 61:
             $answers = new projects_offers_answers();
             $error = $answers->BuyByFM($this->uid, $option['op_count'], $transaction_id, 0);
             if (!$error) {
                 $ok = true;
                 $_SESSION['answers_ammount'] = $option['op_count'];
                 // Публикуем ответы
                 $step_frl = new step_freelancer();
                 $offers = $step_frl->getWizardOffers($this->uid, $option['op_count']);
                 if ($offers) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
                     $step_frl->log = $this->log;
                     $step_frl->user = new users();
                     $step_frl->user->GetUserByUID($this->uid);
                     $step_frl->transferOffers($offers);
                 }
             }
             break;
     }
     return $ok;
 }
Exemple #22
0
 /**
  * Расчет стоимости сформированного проекта
  * 
  * @param array  $items Возвращает данные по проекту (а точнее массив со значениями цены по соответствующим категориям (логотип, цвет,выделение,место наверху))
  * @param double &$PROprice сумма оплаты, если бы у покупателя был PRO 
  * @param bool   $pricesAsArray = false если true, тогда для свойств $items["logo"]  и $items["top"] будет задан 
  *                                 массив array("no_pro" => a, "pro" => b), где b - стоимость опции при наличии у покупателя pro
  *                                 a - стоимость опции расчитанная в зависимости от наличия pro в момент расчета
  * @return integer Сумма оплаты
  */
 function getPrice(&$items = NULL, &$PROprice = 0, $pricesAsArray = false)
 {
     $isPayedUrgent = $this->_project['o_urgent'] == 't';
     $isPayedHide = $this->_project['o_hide'] == 't';
     $is_pro = is_pro(true, $this->_project["user_id"]);
     $addedPrc = $is_pro ? 0 : self::PRICE_ADDED;
     $items['logo']["no_pro"] = ($this->getLogo() && !(int) $this->_project['payed_items'][self::PAYED_IDX_LOGO]) * ($is_pro ? self::PRICE_LOGO : self::PRICE_LOGO_NOPRO);
     $nPrice = $this->isKonkurs() ? ($is_pro ? self::PRICE_CONTEST_TOP1DAY_PRO : self::PRICE_CONTEST_TOP1DAY) + $addedPrc : ($is_pro ? self::PRICE_TOP1DAYPRO : self::PRICE_TOP1DAY) + $addedPrc;
     $nProPrice = $this->isKonkurs() ? self::PRICE_CONTEST_TOP1DAY_PRO : self::PRICE_TOP1DAYPRO;
     $items['urgent'] = array("no_pro" => $this->_project['urgent'] == 't' && !$isPayedUrgent ? self::PRICE_URGENT : 0);
     $items['hide'] = array("no_pro" => $this->_project['hide'] == 't' && !$isPayedHide ? self::PRICE_HIDE : 0);
     $items['top'] = array("no_pro" => $this->getAddedTopDays() * $nPrice);
     if (!$pricesAsArray) {
         $items['top'] = $items["top"]["no_pro"];
         $items['urgent'] = $items["urgent"]["no_pro"];
         $items['hide'] = $items["hide"]["no_pro"];
         $items['logo'] = $items['logo']["no_pro"];
         $price = $items['logo'] + $items['top'] + $items['urgent'] + $items['hide'];
     } else {
         $price = $items['logo']["no_pro"] + $items['top']["no_pro"] + $items['urgent']['no_pro'] + $items['hide']['no_pro'];
     }
     $PROitems['urgent'] = $this->_project['urgent'] == 't' && !$isPayedUrgent ? self::PRICE_URGENT : 0;
     $PROitems['hide'] = $this->_project['hide'] == 't' && !$isPayedHide ? self::PRICE_HIDE : 0;
     $PROitems['logo'] = ($this->getLogo() && !(int) $this->_project['payed_items'][self::PAYED_IDX_LOGO]) * self::PRICE_LOGO;
     $PROnPrice = $this->isKonkurs() ? $is_pro ? self::PRICE_CONTEST_TOP1DAY_PRO : self::PRICE_CONTEST_TOP1DAY : ($is_pro ? self::PRICE_TOP1DAYPRO : self::PRICE_TOP1DAY);
     $PROitems['top'] = $this->getAddedTopDays() * $nProPrice;
     if ($pricesAsArray) {
         $items['top']["pro"] = $PROitems['top'];
         $items['logo']["pro"] = $PROitems['logo'];
         $items['urgent']["pro"] = $PROitems['urgent'];
         $items['hide']["pro"] = $PROitems['hide'];
         $PROprice = $PROitems['logo']["pro"] + $PROitems['top']["pro"] + $PROitems['urgent']["pro"] + $PROitems['hide']["pro"];
     } else {
         $PROprice = $PROitems['logo'] + $PROitems['top'] + $PROitems['urgent'] + $PROitems['hide'];
     }
     if ($this->isKonkurs() && !$this->isEdit()) {
         if (new_projects::isNewContestBudget()) {
             //Блок никогда не выполняется, т.к. метод в условии всегда возвращает false
             $isPro = $this->_project['is_pro'] === 't';
             $cost = $this->_costRub;
             $contestPrice = new_projects::getContestTax($cost, $isPro);
             $price += new_projects::getContestTax($cost, $isPro);
             $PROprice += new_projects::getContestTax($cost, true);
         } else {
             $items['contest']['pro'] = $this->getKonkursPrice(true);
             $items['contest']['no_pro'] = $this->getKonkursPrice();
             $contestPrice = $is_pro ? $items['contest']['pro'] : $items['contest']['no_pro'];
             $price = $price + $contestPrice;
             $PROprice = $PROprice + $items['contest']['pro'];
             if (!$pricesAsArray) {
                 $items['contest'] = $contestPrice;
             }
         }
     }
     if ($this->isVacancy() && (!$this->isEdit() || $this->isStateChangedToPublic())) {
         $items['office'] = $this->getProjectInOfficePrice($is_pro);
         $price = $price + $this->getProjectInOfficePrice($is_pro);
         $PROprice = $PROprice + $this->getProjectInOfficePrice(true);
     }
     return $price > 0 ? $price : 0;
 }
Exemple #23
0
</form>



<?php 
$prop[$i] = account::GetPROStat($fdate, $tdate, 0);
$testpro[$i] = account::GetStatOP(47, $fdate, $tdate);
$prop2[$i] = account::GetPROStat($fdate, $tdate);
$ppp[$i] = account::GetStatOP(array(8), $fdate, $tdate);
$gpp[$i] = account::GetStatOP(array(16, 17, 18, 34, 35), $fdate, $tdate, "", "RIGHT JOIN present ON billing_from_id = account_operations.id");
$fpp[$i] = account::GetStatOP(array(10, 11), $fdate, $tdate);
$fppc[$i] = account::GetStatOP(array(19), $fdate, $tdate);
$fppci[$i] = account::GetStatOP(array(20), $fdate, $tdate);
$cho[$i] = account::GetStatOP(array(21), $fdate, $tdate);
$konkCodes = new_projects::getContestOpCodes();
$konk[$i] = account::GetStatOP($konkCodes, $fdate, $tdate);
$upproj[$i] = account::GetStatOP(array(7), $fdate, $tdate);
$transf[$i] = account::GetStatOP(array(23), $fdate, $tdate);
$testbuypro[$i] = account::GetStatTestBuyPro($fdate, $tdate);
$bonuses[$i] = account::GetStatBonuses($fdate, $tdate);
// Статистика по регистрациям и привязке мобильных телефонов
$regs = stats::getRegStats($fdate, $tdate);
?>

<table  border="1" cellspacing="2" cellpadding="2"  class="brd-tbl">
<tr>
	<td width=200><strong>Проекты:</strong></td>
	<td>
        <?php 
$sql = "SELECT COUNT(*) as cnt FROM projects WHERE kind != 9 AND post_date >= ? AND post_date - '1 day'::interval < ?";
Exemple #24
0
<?php

ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
require_once '../classes/stdf.php';
require_once '../classes/projects.php';
if (empty($argv[1])) {
    new_projects::adWords('upload/adwords.csv');
    exit;
}
$filename = 'upload/adwords0.csv';
// syntax 2012-01-01:2012-12-31
$d = explode(':', $argv[1]);
if (count($d) == 2) {
    $profs = array();
    $groups = array();
    $rows = $DB->rows("SELECT * FROM professions");
    foreach ($rows as $row) {
        $profs[$row['id']] = $row;
    }
    $rows = $DB->rows("SELECT * FROM prof_group");
    foreach ($rows as $row) {
        $groups[$row['id']] = $row;
    }
    $sql = "\n            SELECT\n                p.id, e.compname, country.country_name, city.city_name,\n                date_trunc('seconds', p.create_date) c_date, p.name, p.descr, p.cost, p.currency, p.priceby,\n                array_agg(pts.category_id) cats, array_agg(pts.subcategory_id) subcats\n            FROM\n                projects p\n            INNER JOIN\n                employer e ON e.uid = p.user_id AND e.is_banned = B'0'\n            LEFT JOIN\n                country ON country.id = p.country\n            LEFT JOIN\n                city ON city.id = p.city\n            LEFT JOIN\n                project_to_spec pts ON pts.project_id = p.id\n            LEFT JOIN\n                projects_blocked pb ON pb.project_id = p.id\n            WHERE\n                pb.project_id IS NULL AND p.create_date >= '{$d[0]} 00:00:00' AND p.create_date <= '{$d[1]} 23:59:59'\n            GROUP BY\n                p.id, e.compname, country.country_name, city.city_name, c_date, p.name, p.descr, p.cost, p.currency, p.priceby\n            ORDER BY\n                id DESC\n        ";
    $tmpfile = "/var/tmp/adwords.csv";
    $fp = fopen($tmpfile, "w");
    $res = $DB->query($sql);
    $c = 0;
    while ($row = pg_fetch_assoc($res)) {
        $data = array();
$i = 0;
if ($prjs) {
    setlocale(LC_ALL, 'ru_RU.CP1251');
    $dir = $user->login;
    ?>
    <?php 
    $pj = 0;
    $pn = sizeof($prjs);
    foreach ($prjs as $ikey => $prj) {
        if (!get_uid(false) && $prj['hide'] == 't') {
            $pn--;
            continue;
        }
        $prj['name'] = htmlspecialchars($prj['name'], ENT_QUOTES, 'CP1251', false);
        $prj['descr'] = htmlspecialchars($prj['descr'], ENT_QUOTES, 'CP1251', false);
        $project = new_projects::initData($prj);
        //@todo: Лишний запрос. Применение в код ненайдено. Пока скрываю.
        //$spec = projects::getPrimarySpec($prj['id']);
        //$prj['category'] = $spec['category_id'];
        if (is_new_prj($prj['post_date'])) {
            $blink = getFriendlyURL("blog", $prj['thread_id']);
        } else {
            $blink = getFriendlyURL("project", $prj);
        }
        $plink = "/users/" . $prj['login'] . "/project/?prjid=" . $prj['id'];
        $executorExists = false;
        if ($prj['exec_id']) {
            // если исполнитель выбран
            if ($prj['offer_id']) {
                // если исполнитель отвечал на проект
                $executorExists = true;
Exemple #26
0
<?php

require_once realpath(__DIR__ . '/../../classes/stdf.php');
require_once HOME . '/classes/projects.php';
require_once HOME . '/classes/smtp.php';
require_once HOME . '/classes/template.php';
$id = intval(__paramInit('int', 'id', 'id', 0));
$is_allow = $id > 0 && hasPermissions('projects');
if (!$is_allow) {
    header('Location: /403.php');
    exit;
}
$project = new_projects::initData(new_projects::getPrj($id));
if ($project->isAllowMovedToVacancy()) {
    // ƒелаем проект вакансией
    $project->movedToVacancy();
    // ќтсылаем письмо заказчику о переносе его проекта в раздел вакансии
    $mail = new smtp();
    $mail->subject = '¬аш проект перенесен в раздел ¬акансии и ожидает оплаты';
    // заголовок письма
    $mail->message = Template::render(HOME . '/templates/mail/projects/makevacancy.tpl.php', array('title' => $project->_project['name'], 'project_id' => $project->_project['id'], 'is_pro' => $project->isOwnerPro(), 'pro_price' => $project->getProjectInOfficePrice(true), 'not_pro_price' => $project->getProjectInOfficePrice(false)));
    $mail->recipient = "{$project->_project['email']} <{$project->_project['email']}>";
    // получатель
    $success = $mail->SmtpMail('text/html');
}
$ref_uri = empty($_SESSION['ref_uri']) ? '/' : urldecode($_SESSION['ref_uri']);
header("Location: {$ref_uri}#project-item{$project->_project['id']}");
exit;
Exemple #27
0
$log->TRACE(new_projects::trovitGenerateRss('upload/trovit.xml', $projects_for_xml));
// генерация xml для joobradio
if (date('H') == 4) {
    $log->TRACE(new_projects::jobradioGenerateRss('upload/jobradio.xml'));
    if (users_suspicious_contacts::getResetContacts()) {
        users_suspicious_contacts::resetContacts();
        users_suspicious_contacts::setResetContacts();
    }
}
// генерация xml для careerjet
if (date('H') == 23) {
    $log->TRACE(new_projects::careerjetGenerateRss('upload/careerjet.xml'));
}
// генерация xml для adWords
if (date('H') == 3) {
    $log->TRACE(new_projects::adWords('upload/adwords.csv'));
}
// сбор статистики.
$scl = new stat_collector();
$log->TRACE($scl->Run());
$log->TRACE($scl->wordsStatRun());
if (date('H') == 1) {
    // разделение stat_monthly
    $log->TRACE($scl->stat_monthly_split());
}
// Отсылаем email тем у кого заканчивается закрепление проекта наверху главной страницы
$log->TRACE($mail->EndTopDaysPrjSendAlerts());
if (date('H') == 7) {
    $log->TRACE($mail->sendYdDayRegistry());
    //$log->TRACE( $mail->SbrReqvAlerts() );
    $log->TRACE($mail->SbrDeadlineAlert());
     /* Почему-то этот код здесь был. Не купятся услуги, если при редактировании не покупается логотип
        * Проверка на наличие ранее купленных должна быть именно тут, до создания счета
        * Делалось, видимо, чтобы деньги не списывались при редактировании, но отказ обрабатывать - не выход
         if($opt == 'hide' && $tmpPrj->isEdit()) {
         continue;
         }
         if($opt == 'urgent' && $tmpPrj->isEdit()) {
         continue;
         }
         if($opt == 'top' && $tmpPrj->isEdit()) {
         continue;
         } */
     $option['items'] = array($opt => $value);
     $bill->setOptions($option);
     //Берем код услуги и применяем его, если найден
     $ownOpCode = new_projects::getOpCodeByService($opt);
     if ($ownOpCode) {
         $op_code_pay = $ownOpCode;
     }
     $success = $bill->create($op_code_pay, 0, false);
     if (!$success) {
         break;
     }
 }
 if (!$success) {
     $bill->rollback();
 } else {
     $bill->commit();
     // Сохраним данные проекта при этом убираем платные плюшки
     if ($tmpPrj->isEdit()) {
         if ($items['logo'] > 0) {
/**
 * Скрывает или отображает платные проекты.
 *
 * @see projects_filter::ShowClosedProjects()
 * @see projects_filter::initClosedProjects()
 *
 * @param string $id     id определенного или all для всех
 * @param string $type   скрыть (hide) или показать (unhide)
 * @param int $kind  тип текущей закладки главной страницы (см. new_projects::getProjects())
 * @param int $page  номер текущей страницы.
 * @param bool $filter  включен ли фильтр у юзера.
 *
 * @return object xajaxResponse
 */
function HideProject($id, $type, $kind, $page, $filter)
{
    session_start();
    $objResponse = new xajaxResponse();
    $all = $id == 'all';
    $id = (int) $id;
    $uid = $_SESSION['uid'];
    if ($type == 'hide') {
        if ($all) {
            if ($tops = new_projects::getTopProjects()) {
                foreach ($tops as $t) {
                    $_SESSION['ph'][$t['id']] = base64_encode($t['name']);
                    $objResponse->assign("project-item{$t['id']}", 'outerHTML', '');
                }
            }
            $nDH = $nH * count($_SESSION['ph']);
            unset($_SESSION['top_payed']);
        } else {
            $nDH = $nH;
            $_SESSION['ph'][$id] = base64_encode(projects::GetField($id, 'name'));
            $_SESSION['top_payed']--;
            $objResponse->assign("project-item{$id}", 'outerHTML', '');
        }
    } else {
        if ($all && $_SESSION['ph']) {
            $nDH = -1 * $nH * count($_SESSION['ph']);
            unset($_SESSION['ph']);
        } else {
            $nDH = -1 * $nH;
            unset($_SESSION['ph'][$id]);
            if (!$_SESSION['ph']) {
                unset($_SESSION['ph']);
            }
        }
        if ($filter) {
            $prj_filter = new projects_filters();
            $uf = $prj_filter->GetFilter($uid, $error);
        }
        $prj = new new_projects();
        $content = $prj->SearchDB((int) $kind, (int) $page, 0, $uf, true);
        $objResponse->assign("projects-list", "innerHTML", $content);
    }
    if ($_SESSION['ph']) {
        $ccph = array_keys($_SESSION['ph']);
    }
    setcookie("ph[{$uid}]", $ccph ? implode(',', $ccph) : '', time() + 60 * 60 * 24 * 30, '/');
    $content = projects_filters::ShowClosedProjects((int) $kind, (int) $page, (int) $filter);
    $objResponse->assign("flt-hide-content", "innerHTML", $content);
    $objResponse->assign("flt-hide-cnt", "innerHTML", sizeof($_SESSION['ph']) ? "(" . sizeof($_SESSION['ph']) . ")" : "");
    // компенсируем изменение высоты блока скрытых проектов
    $objResponse->script("height=\$('flt-hide-content').getStyle('height').toInt()+'px';\$('flt-hide-content').getParent().setStyle('height', height);\n    fbox=\$('flt-ph');fslider=new Fx.Slide(fbox.getElement('.flt-cnt'),{duration:400});\n    fbox.f_isShw=fbox.hasClass('flt-show');fbox.getElement('.flt-cnt').setStyle('display','block');\n    if(fbox.f_isShw){fslider.show();}else{fslider.hide();}");
    return $objResponse;
}
 /**
  * Обрабатываем данные для ввывода информации по шагу 
  */
 public function actionProjects()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     $prj_id = __paramInit('int', 'project', null, 0);
     if ($prj_id > 0) {
         $obj_project = new projects();
         $project = $obj_project->GetPrjCust($prj_id);
     }
     if ($project['id'] > 0) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/opinions.php";
         // Загружаем данные по отзывам автора проекта
         $op_data = opinions::getCounts($project['user_id'], array('frl', 'norisk', 'all', 'total'));
         //$op_data['norisk']['a'] = ( (int)$op_data['norisk']['p'] + (int)$op_data['norisk']['n'] + (int)$op_data['norisk']['m'] );
         //$op_data['all']['a']    = ( (int)$op_data['all']['p']    + (int)$op_data['all']['n']    + (int)$op_data['all']['m'] );
         $op_data['total']['a'] = (int) $op_data['total']['p'] + (int) $op_data['total']['n'] + (int) $op_data['total']['m'];
         $user = new users();
         $user->GetUserByUID($project['user_id']);
         $registered = strtolower(ElapsedMnths(strtotime($project['reg_date'])));
         $is_offer = $this->isOfferProject($project['id']);
         $count_offer = $this->countOffers();
         $count_pay_offer = $this->countPayOffers();
         // Максимальное количество ответов для пользователя
         $max_offers = 3 + $count_pay_offer;
         // Обработка запросов на странице
         $action = __paramInit('string', null, 'action');
         if ($action && ($count_offer < $max_offers || $project['kind'] == 7 || $action == 'paid_offer')) {
             $error = $this->actionProcessingProjects($action, $project);
         }
         include $_SERVER['DOCUMENT_ROOT'] . "/wizard/registration/steps/tpl.step.answer.php";
     } else {
         $filter = array();
         $category = $_COOKIE[$this->parent->getCookieName('categories')];
         $subcategory = $_COOKIE[$this->parent->getCookieName('subcategories')];
         if ($category > 0) {
             $cat[] = professions::GetGroupName($category);
             $filter['active'] = 't';
             $filter['my_specs'] = 'f';
             $filter['categories'][0] = array($category => '0');
             if ($subcategory > 0) {
                 $cat[] = professions::GetProfName($subcategory);
                 unset($filter['categories'][0]);
                 $filter['categories'][1] = array($subcategory => '1');
             }
             $category_name = implode(": ", $cat);
         }
         $obj_project = new new_projects();
         $obj_project->page_size = step_freelancer::DEF_PROJECTS_PER_PAGE;
         $projects = $obj_project->getProjects($count, -1, 1, false, $filter, true, false, NULL, true);
         include $_SERVER['DOCUMENT_ROOT'] . "/wizard/registration/steps/tpl.step.search.php";
     }
 }