예제 #1
0
function openEditWork($uid, $params)
{
    $objResponse =& new xajaxResponse();
    if ($uid == null) {
        $uid = get_uid(false);
    }
    $uid = intval($uid);
    $work_id = intval($params['id']);
    $prof_id = intval($params['prof_id']);
    if ($uid != get_uid(false) || !get_uid(false) || $prof_id <= 0 && $prof_id != -4 && $prof_id != -3) {
        return $objResponse;
    }
    $wmode_margin = 80;
    if ($work_id == 0) {
        // Значит новую работу надо
        $is_edit = false;
        $work = array();
        $work['prof_id'] = $prof_id;
        $wmode_margin = 57;
    } else {
        $portfolio = new portfolio();
        $work = $portfolio->GetPortfById($work_id);
        if ($work['user_id '] == $uid) {
            return $objResponse;
        }
        $is_edit = true;
    }
    ob_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.portfolio-work-edit.php';
    $sHtml = ob_get_contents();
    ob_end_clean();
    $btn_file__portf = $work['pict'] ? 'Заменить файл' : 'Загрузить файл';
    $btn_file_preview = $work['prev_pict'] ? 'Заменить картинку' : 'Загрузить картинку';
    $setting_uploader = "{ is_replace: true, text: { uploadButton: '{$btn_file__portf}'}, validation: { maxFileCount: 1 } }";
    $setting_uploader_preview = "{ is_replace: true, text: { uploadButton: '{$btn_file_preview}'}, validation: { maxFileCount: 1, restrictedExtensions: [], allowedExtensions: ['gif', 'jpg', 'jpeg', 'png'] }, umask: '" . uploader::umask('pf_preview') . "' }";
    $objResponse->assign('popup_loader', 'innerHTML', $sHtml);
    $objResponse->script("portfolio.initPopup('portfolio_work_edit');");
    $objResponse->script("portfolio.initExpandLink('portfolio_work_edit');");
    $objResponse->script("ComboboxManager.initCombobox( \$('portfolio_work_edit').getElements('.b-combo__input') );");
    $objResponse->script("uploader.create('work_main_file', {$setting_uploader});");
    $objResponse->script("uploader.create('work_preview_file', {$setting_uploader_preview});");
    $objResponse->script("var opts = \$('swf_params').getElement('select').options;\n        for (var i = 0; i < opts.length; i++) {\n            if (opts[i].text == '{$work['wmode']}') {\n                \$('swf_params').getElement('select').selectedIndex = i;\n            }\n        }\n        if ( \$\$('div.qq-upload-portfolio') ) {\n            \$\$('div.qq-upload-portfolio').setStyle('margin-top', '{$wmode_margin}px');\n        }\n    ");
    return $objResponse;
}
예제 #2
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;
}
예제 #3
0
                    <?php 
    } else {
        ?>
			 <?php 
        $sTitle = $project['moderator_status'] === '0' && $project['kind'] != 4 && $project['is_pro'] != 't' ? $stop_words->replace($project['name'], 'plain', false) : $project['name'];
        ?>
                         <?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">