Exemplo n.º 1
0
 public function run()
 {
     $is_allow_feedback = (!$this->order['close_date'] || TServiceOrderFeedbackModel::isAllowFeedback($this->order['close_date'])) && (!isset($this->order['reserve']) || $this->order['reserve']->isAllowFeedback($this->is_emp));
     $date_feedback = ($this->order['close_date'] ? strtotime($this->order['close_date']) : time()) + TServiceOrderFeedbackModel::LIFETIME;
     $date_feedback_formatted = date("d.m.Y H:i", $date_feedback);
     //собираем шаблон
     $this->render('t-service-order-status', array('is_adm' => !$this->is_owner, 'user' => $this->order[$this->is_emp ? 'freelancer' : 'employer'], 'order_id' => $this->order['id'], 'order_status' => $this->order['status'], 'is_emp' => $this->is_emp, 'tax' => $this->order['tax'], 'tax_price' => $this->order['tax_price'], 'freelancer' => @$this->order['freelancer'], 'employer' => @$this->order['employer'], 'frl_feedback_id' => $this->order['frl_feedback_id'], 'frl_feedback' => $this->order['frl_feedback'], 'is_frl_feedback' => !empty($this->order['frl_feedback']), 'frl_is_good' => $this->order['frl_rating'] > 0, 'frl_rating' => intval($this->order['frl_rating']), 'emp_feedback_id' => $this->order['emp_feedback_id'], 'emp_feedback' => $this->order['emp_feedback'], 'is_emp_feedback' => !empty($this->order['emp_feedback']), 'emp_is_good' => $this->order['emp_rating'] > 0, 'emp_rating' => intval($this->order['emp_rating']), 'is_allow_feedback' => $is_allow_feedback, 'date_feedback' => $date_feedback_formatted, 'order_title' => $this->order['title'], 'order_price' => $this->order['order_price'], 'order_days' => $this->order['order_days'], 'pay_type' => $this->order['pay_type'], 'is_reserve_accepted' => isset($this->order['reserve_data']), 'reserve_data' => @$this->order['reserve_data'], 'reserve' => @$this->order['reserve'], 'is_list' => $this->is_list));
 }
Exemplo n.º 2
0
        }
        ?>
" id="op_message_<?php 
        echo $theme['id'] . $uniq_id_sufix;
        ?>
">
                            <?php 
        echo reformat($theme['descr'], 30, 0, 0, 1);
        ?>
                        </div>
                        <?php 
        if ($theme['opinion_type'] == 2) {
            $is_allow_edit = FALSE;
            $is_owner = $theme['touser_id'] == $uid;
            if ($is_owner) {
                $is_allow_edit = $theme['sbr_rating'] < 0 || TServiceOrderFeedbackModel::isAllowFeedback($theme['posted_time']);
            }
            $is_allow_edit = $is_tservices_adm || $is_allow_edit;
            $is_allow_delete = $is_tservices_adm || $is_owner;
            ?>
                            <?php 
            if ($is_allow_edit || $is_allow_delete) {
                ?>
                        <div class="b-post__foot b-post__foot_padtop_10">
                            <?php 
                if ($is_allow_edit) {
                    ?>
                            <a class="b-post__link b-post__link_dot_c10601" href="javascript:void(0)" onclick="xajax_tservicesOrdersEditFeedback(<?php 
                    echo $theme['id'];
                    ?>
);">
/**
 * Редактирование отзыва по заказу ТУ
 * 
 * @param type $feedback_id
 * @return \xajaxResponse
 */
function tservicesOrdersEditFeedback($feedback_id)
{
    $uid = get_uid(false);
    $objResponse =& new xajaxResponse();
    $orderFeedbackModel = new TServiceOrderFeedbackModel();
    $data = $orderFeedbackModel->getFeedback($feedback_id);
    if (!$data) {
        return $objResponse;
    }
    $is_adm = hasPermissions('tservices');
    $is_owner = $data['user_id'] == $uid;
    $is_editable = $data['rating'] < 0 || TServiceOrderFeedbackModel::isAllowFeedback($data['posted_time']);
    if (!($is_owner && $is_editable) && !$is_adm) {
        return $objResponse;
    }
    //$data['hash'] = md5(TServiceOrderModel::SOLT . $feedback_id);
    $content = Template::render(ABS_PATH . '/tu/tpl.order-feedback-form.php', $data);
    $ele_id = 'form_container_' . $feedback_id . '-2';
    $objResponse->script("\$\$('.editFormSbr').set('html', '&nbsp;').setStyle('display', 'none');");
    $objResponse->script("\$\$('.sbrmsgblock').setStyle('display', 'block');");
    $objResponse->script("\$('form_container_to_{$feedback_id}-2').setStyle('display', 'none');");
    $objResponse->script("\$('{$ele_id}').setStyle('display', 'block');");
    $objResponse->assign($ele_id, "innerHTML", $content);
    return $objResponse;
}