Exemplo n.º 1
0
/**
 * Возвращает список жалоб на проект в админке.
 * 
 * с xajax не работает
 * 
 * @param  int $nProjId Идентификатор проекта на который жалуются
 * @param  string $group группа, в которой находится -> (new, approved, refused)
 * @return string json_encode данные
 */
function getProjectComplaints($nPrjId = 0, $group = 'new')
{
    session_start();
    $res = array();
    if (hasPermissions('projects') && $nPrjId) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
        $oPrj = new projects();
        $aMsgs = $oPrj->getProjectComplaints($nPrjId, $group);
        $aData = array();
        foreach ($aMsgs as $aOne) {
            $aFiles = array();
            if ($aOne['files']) {
                $files = preg_split("/,/", $aOne['files']);
                foreach ($files as $file) {
                    if ($file && $file != 'false') {
                        $aFiles[] = '<a target="_blank" href="' . WDCPREFIX . '/users/' . $aOne['e_login'] . '/upload/' . $file . '">' . $file . '</a><br/>';
                    }
                }
            }
            $status = 0;
            if ($aOne['is_satisfied'] == 't') {
                $status = 1;
            } elseif ($aOne['is_satisfied'] == 'f') {
                $status = 2;
            }
            $aTmp = array('login' => iconv('CP1251', 'UTF-8', $aOne['login']), 'name' => iconv('CP1251', 'UTF-8', $aOne['uname']), 'surname' => iconv('CP1251', 'UTF-8', $aOne['usurname']), 'date' => date('d.m.Y', strtotime($aOne['date'])), 'text' => $aOne['msg'] ? iconv('CP1251', 'UTF-8', reformat(html_entity_decode($aOne['msg'], ENT_QUOTES), 60)) : '', 'type' => iconv('CP1251', 'UTF-8', projects_complains::GetComplainType($aOne['type'], true)), 'status' => $status, 'pdate' => date('d.m.Y', strtotime($aOne['processed_at'])), 'admin_login' => iconv('CP1251', 'UTF-8', $aOne['admin_login']), 'admin_uname' => iconv('CP1251', 'UTF-8', $aOne['admin_uname']), 'admin_usurname' => iconv('CP1251', 'UTF-8', $aOne['admin_usurname']), 'files' => $aFiles);
            $aData[] = $aTmp;
        }
        $res['success'] = true;
        $res['data'] = $aData;
    } else {
        $res['success'] = false;
    }
    echo json_encode($res);
}
Exemplo n.º 2
0
    $delete = array();
    foreach ($_POST['name'] as $cTypeKey => $cTypeName) {
        if (!trim($cTypeName)) {
            continue;
        }
        $ctID = __paramValue('int', $_POST['id'][$cTypeKey]);
        $ctName = trim(__paramValue('string', $_POST['name'][$cTypeKey]));
        $ctTextarea = __paramValue('bool', $_POST['textarea'][$cTypeKey]);
        $ctRequired = __paramValue('bool', $_POST['required'][$cTypeKey]);
        $ctPos = __paramValue('int', $_POST['pos'][$cTypeKey]);
        if ($ctPos > 99) {
            $ctPos = 99;
        } elseif ($ctPos < -99) {
            $ctPos = -99;
        } elseif (!$ctPos) {
            $ctPos = 1;
        }
        $ctDel = __paramValue('int', $_POST['del'][$cTypeKey]);
        if (!$ctID && !$ctDel) {
            $add[] = array('name' => $ctName, 'textarea' => $ctTextarea, 'required' => $ctRequired, 'pos' => $ctPos);
        } elseif ($ctDel && $ctID) {
            $delete[] = array('id' => $ctID);
        } elseif ($ctID && !$ctDel) {
            $edit[] = array('id' => $ctID, 'name' => $ctName, 'textarea' => $ctTextarea, 'required' => $ctRequired, 'pos' => $ctPos);
        }
    }
    projects_complains::updateTypes($add, $edit, $delete, $moder);
}
$complainTypes = projects_complains::getTypes($moder, false);
$css_file = array('moderation.css', 'nav.css');
include $rpath . 'template.php';
Exemplo n.º 3
0
/**
* Добавляет жалобу на проект.
*
* @param    integer     $project_id     ID проекта
* @param    integer     $user_id        ID пользователя
* @param    integer     $type           тип жалобы
* @param    string      $msg            текст жалобы
* @param    string      $files          имена загруженных скриншотов
*
* @return                               xajax responce
*/
function SendComplain($project_id, $type, $msg, $files)
{
    global $session;
    session_start();
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_complains.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/userecho.php';
    $objResponse = new xajaxResponse();
    $project_id = (int) $project_id;
    $user_id = get_uid(false);
    $type = (int) $type;
    $msg = __paramValue('htmltext', $msg);
    $error = false;
    $project = new projects();
    $prj = $project->GetPrj(0, $project_id, 1);
    $file_list = array();
    if ($files != '') {
        $files = uploader::sgetFiles($files);
        if (!empty($files)) {
            $emp = new users();
            $emp->GetUser($emp->GetField($prj['user_id'], $ee, 'login'));
            $dir = 'users/' . substr($emp->login, 0, 2) . '/' . $emp->login . '/upload/';
            foreach ($files as $file) {
                $copy = uploader::remoteCopy($file['id'], 'file_projects', $dir);
                $rfiles[] = $copy->name;
                $file_list[] = array('name' => $copy->original_name, 'link' => WDCPREFIX . '/' . $copy->path . $copy->name);
            }
            $files = implode(',', $rfiles);
        } else {
            $files = '';
        }
    }
    if (!$files) {
        $files = '';
    }
    if (projects::IsHaveComplainType($project_id, $user_id, $type)) {
        // Уже жаловался
        return $objResponse;
    }
    $projects_complains = new projects_complains();
    $type_name = $projects_complains->GetComplainType($type);
    $project_url = getAbsUrl(getFriendlyURL('project', $project_id));
    $is_moder = $projects_complains->isComplainTypeModer($type);
    if ($is_moder) {
        $userEcho = new UserEcho();
        $topic_message = $userEcho->constructMessage($project_url, $prj['name'], $msg, $file_list);
        $topicUrl = $userEcho->newTopicComplain($type_name, $topic_message, $file_list);
        if ($topicUrl) {
            messages::sendProjectComplain($user_id, $project_url, $prj['name'], $msg, $topicUrl);
        } else {
            $error = true;
        }
    }
    if (!$error) {
        $error = projects::AddComplain($project_id, $user_id, $type, $msg, $files, $is_moder && $topicUrl);
    }
    if ($error) {
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').removeClass('b-layout__txt_hide'); abuseResetSelection();");
        } else {
            $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_rectangle_color_disable')");
        }
    } else {
        $upl = array('umask' => uploader::umask('prj_abuse'), 'validation' => array('allowedExtensions' => array('jpg', 'gif', 'png', 'jpeg'), 'restrictedExtensions' => array()), 'text' => array('uploadButton' => iconv('cp1251', 'utf8', 'Прикрепить файлы')));
        $objResponse->script("\n            \$('abuse{$type}').addClass('abuse-checked');\n            \$('abuse{$type}').getChildren().each(function(el) { \$(el).addClass('abuse-checked'); });\n        ");
        $objResponse->script("uploader.create('abuse_uploader', " . json_encode($upl) . ');');
        $objResponse->script("\$('prj_abuse_msg').set('value', '')");
        $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_disabled')");
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        $objResponse->script("\$('project_abuse_success').removeClass('b-layout__txt_hide');");
        $objResponse->script("\$('form_abuse').hide();");
        $objResponse->script("setTimeout(\"\$('project_abuse_success').addClass('b-layout__txt_hide')\", 5000);");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').addClass('b-layout__txt_hide');");
        }
    }
    return $objResponse;
}
Exemplo n.º 4
0
    echo getFriendlyURL("project", $prj['id']);
    ?>
">Предложения (<?php 
    echo (int) $prj['offers_count'];
    ?>
)</a></div></li>
									</ul> 
                                    <br clear="all" />
                                        
    									<div id="div_compliant_<?php 
    echo $prj['id'];
    ?>
" class="ban-report"> 
    										<h4>
                                                <?php 
    echo projects_complains::GetComplainType($prj['type'], true);
    ?>
                                            </h4> 
                                            <p><?php 
    echo reformat(html_entity_decode($prj['msg'], ENT_QUOTES), 60);
    ?>
</p> 
                                            <?php 
    if ($prj['c_files'] && $prj['c_files'] != 'false') {
        echo '<p>';
        $files = preg_split("/,/", $prj['c_files']);
        foreach ($files as $file) {
            echo '<a href="' . WDCPREFIX . '/users/' . $prj['login'] . '/upload/' . $file . '">' . $file . '</a><br>';
        }
        echo '</p>';
    }
Exemplo n.º 5
0
        ?>
                         <?php 
        if (!is_emp() && !($project['exec_id'] && $exec_info)) {
            ?>
                             <div class="b-buttons b-buttons_padbot_30">
				  <?php 
            if (get_uid(false) && $project['kind'] != 9) {
                ?>
                                    <div class="b-layout__txt b-layout__txt_padtop_10 b-layout__txt_float_right i-shadow"><?php 
                $templates = array(uploader::getTemplate('uploader', 'project_abuse/'), uploader::getTemplate('uploader.file', 'project_abuse/'), uploader::getTemplate('uploader.popup', 'project_abuse/'));
                uploader::init(array('abuse_uploader' => array('umask' => uploader::umask('prj_abuse'), 'validation' => array('allowedExtensions' => array('jpg', 'gif', 'png', 'jpeg'), 'restrictedExtensions' => array(), 'sizeLimit' => tmp_project::MAX_FILE_SIZE), 'text' => array('uploadButton' => iconv('cp1251', 'utf8', 'Прикрепить файлы')))), $templates);
                $complain = true;
                $obj_project->IsHaveComplain($project['id'], get_uid(), $complain);
                $is_project_complain_sent = $obj_project->isComplainSent($project['id']);
                require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects_complains.php";
                $complainTypes = projects_complains::getTypes();
                include $_SERVER['DOCUMENT_ROOT'] . "/projects/tpl.abuse.php";
                ?>
                                        
                                        <span class="b-layout__txt_color_c10600">Пожаловаться на проект: 
                                        &nbsp;&nbsp;&nbsp;<a class="b-layout__link b-layout__link_dot_c10600 abuse-employer-project-link" href="javascript:void(0)">Работодателю</a>
                                        &nbsp;/&nbsp; <a class="b-layout__link b-layout__link_dot_c10600 abuse-moderator-project-link" href="javascript:void(0)">Модератору</a>
                                        </span> 
                                        &#160; <img class="b-layout__pic b-layout__pic_absolute b-layout__txt_hide" id="project_abuse_success" style="top:-8px; left:400px" src="/images/thanks.png" width="80" height="36">
                                        
                                         
                                    </div>
                                 <?php 
            }
            ?>
                                
Exemplo n.º 6
0
<?php

/**
 * Статистика жалоб на проекты
 * 
 */
// Границы деления по бюджету
$bounds = array(500, 2000, 5000, 10000, 20000, 50000);
define('IS_SITE_ADMIN', 1);
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects_complains.php";
hasPermissions('stats') || hasPermissions('users') || header_location_exit('/404.php');
$rpath = "../../";
$menu_item = 24;
// Номер пункта меню - подсветка.
$header = $rpath . 'header.new.php';
$inner_page = "index_inner.php";
$content = '../content.php';
$footer = $rpath . 'footer.new.html';
$template = 'template3.php';
$css_file = array('moderation.css', 'new-admin.css', 'nav.css');
// Общее количество с делением "от про / не про"
$complains_all = projects_complains::GetComplainsStats('from');
// Деление по бюджету
$bcnt = count($bounds);
$complains_by_cost = projects_complains::GetComplainsStats('cost', $bounds);
// По категориям
$complains_categ = projects_complains::GetComplainsStats('category');
include $rpath . $template;