Beispiel #1
0
    $sHref = "%s" . $cur_page_url . "page=%d%s";
    if ($page > 1) {
        $additional_header .= '<link rel="prev" href="' . $cur_page_url . 'page=' . ($page - 1) . '">';
    }
    if ($page < $pages) {
        $additional_header .= '<link rel="next" href="' . $cur_page_url . 'page=' . ($page + 1) . '">';
    }
    $content = "content.php";
}
//------------------------------------------------------------------------------
// Попапы закреплений фрилансеров ----------------------------------------------
$popup = __paramInit('string', 'popup');
$freelancer_binds = new freelancer_binds();
$is_spec = $prof_id > 0;
$prof_use = $is_spec ? professions::GetProfessionOrigin($prof_id) : $prof_group_id;
$allow_frl_bind = $freelancer_binds->isAllowBind($uid, $prof_use, $is_spec);
$binded_to = $freelancer_binds->getBindDateStop($uid, $prof_use, $is_spec);
if ($allow_frl_bind || $binded_to) {
    quickPaymentPopupFrlbind::getInstance()->init(array('prof_id' => $prof_id, 'prof_group_id' => $prof_group_id, 'prof_use' => $prof_use, 'is_spec' => $is_spec, 'ammount' => $freelancer_binds->getPrice($prof_use, $is_spec, (bool) $binded_to, $uid), 'date_stop' => $binded_to, 'autoshow' => $popup == 'bind_prolong', 'addprof' => $is_spec && $freelancer_binds->needAddProf($uid, $prof_use)));
}
$is_bind_first = $freelancer_binds->isBindFirst($uid, $prof_use, $is_spec);
if ($binded_to && !$is_bind_first) {
    quickPaymentPopupFrlbindup::getInstance()->init(array('prof_id' => $prof_use, 'is_spec' => $is_spec, 'ammount' => $freelancer_binds->getPriceUp($prof_use, $is_spec, $uid), 'autoshow' => $popup == 'bind_up'));
}
$is_binded_hide = $binded_to && !$freelancer_binds->isAllowBind($uid, $prof_use, $is_spec, false);
//------------------------------------------------------------------------------
unset($_SESSION['payed_frl_' . md5($_SERVER['REQUEST_URI'])]);
$first_pages = array();
if ($prof_group_id) {
    $first_pages = firstpage::GetAll($prof_group_id, array(), true);
} else {
/**
 * Оплата через Плати потом
 * 
 * @param type $type - тип оплаты
 * @param type $data - данные по параметрам покупаемой услуги
 * @return \xajaxResponse
 */
function quickPaymentFrlbindPlatipotom($type, $data)
{
    $is_error = true;
    $uid = get_uid(false);
    $objResponse =& new xajaxResponse();
    $prof_id = (int) @$data['prof_id'];
    $is_spec = (bool) @$data['is_spec'];
    $is_prolong = (bool) @$data['is_prolong'];
    $promo_code = (string) @$data['promo'];
    $freelancer_binds = new freelancer_binds();
    $valid = $is_prolong ? $freelancer_binds->isUserBinded($uid, $prof_id, $is_spec) : $freelancer_binds->isAllowBind($uid, $prof_id, $is_spec);
    if ($valid) {
        $is_error = false;
        $bill = new billing($uid);
        //Допустимо использование промокодов
        $bill->setPromoCodes('SERVICE_FRLBIND', $promo_code);
        $op_code = $freelancer_binds->getOpCode($prof_id, $is_spec, $is_prolong);
        $option = array('weeks' => (int) @$data['weeks'], 'prof_id' => $prof_id);
        //Формируем заказ
        $billReserveId = $bill->addServiceAndCheckout($op_code, $option);
        $payed_sum = $bill->getRealPayedSum();
        $platipotom = new platipotom();
        $html_form = $platipotom->render($payed_sum, $bill->account->id, $billReserveId);
        if ($html_form) {
            $objResponse->script("\n                var qp_form_wrapper = \$\$('#quick_payment_frlbind .__quick_payment_form');\n                if(qp_form_wrapper){    \n                    qp_form_wrapper.set('html','{$html_form}');\n                    qp_form_wrapper.getElement('form')[0].submit();\n                }\n            ");
            $link = '/freelancers/';
            if ($prof_id) {
                if ($is_spec) {
                    $link .= professions::GetProfLink($prof_id) . '/';
                } else {
                    $group = professions::GetGroup($prof_id, $error);
                    $link .= $group['link'] . '/';
                }
            }
            //сохранаем в сессию куда перейти при успешной покупке
            $_SESSION[quickPaymentPopup::QPP_REDIRECT] = $link;
        }
    }
    // Показываем предупреждение в случае ошибки
    if ($is_error) {
        $action = $is_prolong ? 'продлении закрепления' : 'закреплении';
        $objResponse->script("\n            var qp = window.quick_payment_factory.getQuickPayment('frlbind');\n            if(qp) qp.show_error('Возникла ошибка при {$action} в каталоге!');\n        ");
    }
    return $objResponse;
}