Example #1
0
/**
 * Вернуть контактные данные фрилансера если есть доступ их смотреть
 * 
 * @param type $login
 * @param type $hash
 * @return \xajaxResponse
 */
function getContactsInfo($login, $hash)
{
    $objResponse = new xajaxResponse();
    if ($hash === paramsHash(array($login))) {
        $freelancer = new freelancer();
        $freelancer->GetUser($login);
        if ($freelancer->uid > 0 && !is_emp($freelancer->role) && is_view_contacts($freelancer->uid) && is_contacts_not_empty($freelancer)) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/template.php';
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
            require_once ABS_PATH . '/classes/statistic/StatisticFactory.php';
            require_once ABS_PATH . '/classes/users.php';
            $html = Template::render($_SERVER['DOCUMENT_ROOT'] . '/user/contacts_info.php', array('user' => $freelancer));
            $ga = StatisticFactory::getInstance('GA');
            $ga->queue('event', array('uid' => isset($_SESSION['uid']) ? $_SESSION['uid'] : 0, 'cid' => users::getCid(), 'category' => 'Freelancer', 'action' => 'show_contacts', 'label' => "{'login': '******'}"));
            $objResponse->assign('contacts_info_block', 'innerHTML', $html);
        }
    }
    return $objResponse;
}
 protected function init($params)
 {
     $page = isset($params['page']) && $params['page'] > 0 ? intval($params['page']) : 1;
     $this->current_tab = isset($params['tab']) && isset($this->tabs[$params['tab']]) ? $params['tab'] : $this->current_tab;
     $user = array('uid' => $_SESSION['uid'], 'login' => $_SESSION['login']);
     $options = array('popup_title' => 'Выберите превью для отображения в каталоге', 'popup_width' => 720);
     if ($this->is_ajax) {
         $method_name = $this->getTabMethodName($this->current_tab);
         $tab_data = $this->{$method_name}($user, $page);
         $content = Template::render(__DIR__ . '/views/freelancers-preview-editor-popup-tab-content.php', array('value' => $tab_data, 'key' => $this->current_tab));
     } else {
         $tabs = array();
         $first_exist_tab = null;
         foreach ($this->tabs as $key => $value) {
             $method_name = $this->getTabMethodName($key);
             $tab_data = $this->{$method_name}($user, $page);
             if ($tab_data) {
                 $tabs[$key] = $tab_data;
                 $tabs[$key]['title'] = $value;
                 $tabs[$key]['active'] = $key == $this->current_tab;
                 if (!$first_exist_tab) {
                     $first_exist_tab = $key;
                 }
             }
         }
         //Если табов активных поумолчанию нет то включаем первую существующую
         if (!isset($tabs[$this->current_tab]['active']) && $first_exist_tab) {
             $tabs[$first_exist_tab]['active'] = true;
         }
         $group_id = isset($params['group_id']) ? $params['group_id'] : 0;
         $prof_id = isset($params['prof_id']) ? $params['prof_id'] : 0;
         $hash = paramsHash(array($group_id, $prof_id));
         $content = Template::render(__DIR__ . '/views/freelancers-preview-editor-popup.php', array('tabs' => $tabs, 'tab_panel_name' => "{$this->id}Tab", 'group_id' => $group_id, 'prof_id' => $prof_id, 'hash' => $hash));
     }
     $this->setContent($content);
     return $options;
 }
 /**
  * Провека параметров и подготовка настроек 
  * для обновлении или добавления
  * 
  * @param type $data
  * @return type
  */
 public function isValid($data)
 {
     require_once ABS_PATH . '/freelancers/widgets/FreelancersPreviewWidget.php';
     require_once ABS_PATH . '/classes/freelancer.php';
     $this->is_valid = false;
     $max_pos = FreelancersPreviewWidget::MAX_ITEMS;
     $this->group_id = isset($data['group']) ? intval($data['group']) : 0;
     $this->prof_id = isset($data['prof']) ? intval($data['prof']) : 0;
     $hash = isset($data['hash']) ? $data['hash'] : null;
     //Проверка группы/раздела именно тех на странице которых был открыт попап
     if ($hash !== paramsHash(array($this->group_id, $this->prof_id))) {
         return $this->is_valid;
     }
     $value = isset($data['value']) ? $data['value'] : '';
     $this->uid = isset($data['uid']) && $data['uid'] > 0 ? $data['uid'] : null;
     $this->pos = isset($data['pos']) && $data['pos'] > 0 && $data['pos'] <= $max_pos ? intval($data['pos']) : null;
     if (!$this->uid || !$this->pos || empty($value)) {
         return $this->is_valid;
     }
     $user = new freelancer();
     $user->GetUserByUID($this->uid);
     if ($user->uid <= 0) {
         return $this->is_valid;
     }
     $pattern = implode('|', FreelancersPreviewEditorPopup::$types);
     $matches = array();
     if (preg_match("/^({$pattern})_([0-9]+)\$/", $value, $matches)) {
         $this->type = self::$type_from_string[$matches[1]];
         $this->src_id = $matches[2];
         switch ($this->type) {
             case self::TYPE_PF:
                 require_once ABS_PATH . '/classes/portfolio.php';
                 $portfolio = new portfolio();
                 $this->is_valid = (bool) $portfolio->isExistActive($this->uid, $this->src_id);
                 break;
             case self::TYPE_TU:
                 require_once ABS_PATH . '/classes/tservices/tservices.php';
                 $tservices = new tservices($this->uid);
                 $this->is_valid = (bool) $tservices->isExistActive($this->src_id);
                 break;
         }
         if ($this->is_valid) {
             $res = $this->getRowByUidAndPos($this->uid, $this->pos, $this->group_id, $this->prof_id);
             $this->id = $res ? $res['id'] : 0;
             //Уже есть данная позиция
             //то готовим данные для обновления
             if ($this->id > 0) {
                 $this->data = array('src_id' => $this->src_id, 'type' => $this->type, 'is_default' => false);
                 $this->is_default = $res['is_default'] == 't';
                 //Первое добавление позиции
                 //то готовим новые данные для добавления
             } else {
                 $exist_data = isset($_SESSION[self::SESS_EXIST_PREVIEW_DATA]) ? $_SESSION[self::SESS_EXIST_PREVIEW_DATA] : null;
                 for ($idx = 1; $idx <= $max_pos; $idx++) {
                     if ($idx == $this->pos) {
                         $this->data[$idx] = array('src_id' => $this->src_id, 'type' => $this->type, 'user_id' => $this->uid, 'pos' => $idx, 'group_id' => $this->group_id, 'prof_id' => $this->prof_id, 'is_default' => false);
                     } elseif (isset($exist_data['ids'][$idx - 1])) {
                         $this->data[$idx] = array('src_id' => $exist_data['ids'][$idx - 1], 'type' => $exist_data['type'], 'user_id' => $this->uid, 'pos' => $idx, 'group_id' => $this->group_id, 'prof_id' => $this->prof_id, 'is_default' => false);
                     }
                 }
             }
             //Устанавливаем по возможности
             //текущии настройки для общего каталога / раздела
             /*
               - общий каталог поумолчанию из основного подраздела (специализации), но может и настраиваться по своему
               - раздел каталога поумолчанию из последнего отредактированного подраздела, но может настраиваться по своему
               - подраздел (специализация) настраивается по своему 
             */
             if ($this->prof_id > 0 && $this->group_id == 0 && count($this->data)) {
                 $is_exist_setting_for_catalog = false;
                 $is_exist_setting_for_group = false;
                 require_once ABS_PATH . '/classes/professions.php';
                 $group_id = professions::GetGroupIdByProf($this->prof_id);
                 $exist_data = $this->getExistData($group_id);
                 $current_settings = array();
                 if ($exist_data) {
                     foreach ($exist_data as $el) {
                         //Существующие текущие настройки раздела
                         if ($el['prof_id'] == $this->prof_id && $el['group_id'] == 0) {
                             unset($el['id']);
                             if ($el['pos'] == $this->pos) {
                                 $el['src_id'] = $this->src_id;
                                 $el['type'] = $this->type;
                             }
                             $current_settings[$el['pos']] = $el;
                             //Существующие настройки для общего каталога
                         } elseif ($el['prof_id'] == 0 && $el['group_id'] == 0 && $el['is_default'] == 'f') {
                             $is_exist_setting_for_catalog = true;
                             //Существующие настройки для группы
                         } elseif ($el['prof_id'] == 0 && $el['group_id'] == $group_id && $el['is_default'] == 'f') {
                             $is_exist_setting_for_group = true;
                         }
                     }
                 }
                 //Если настройки для каталога нет и эта основная
                 //специализация то ее добавляем в общий каталог
                 $data_extended = array();
                 $current_settings = $this->id > 0 ? $current_settings : $current_settings + $this->data;
                 if (!$is_exist_setting_for_catalog) {
                     $is_main_prof = (bool) $this->db()->val('SELECT 1 FROM freelancer 
                              WHERE uid = ?i AND spec = ?i LIMIT 1', $this->uid, $this->prof_id);
                     if ($is_main_prof) {
                         foreach ($current_settings as $el) {
                             $el['prof_id'] = 0;
                             $el['group_id'] = 0;
                             $el['is_default'] = true;
                             $data_extended[] = $el;
                         }
                     }
                 }
                 //Если нет настроек для группы раздела то добавляем текущии
                 //настройки как поумолчанию для группы
                 if (!$is_exist_setting_for_group) {
                     foreach ($current_settings as $el) {
                         $el['prof_id'] = 0;
                         $el['group_id'] = $group_id;
                         $el['is_default'] = true;
                         $data_extended[] = $el;
                     }
                 }
                 if ($data_extended) {
                     $this->data_extra_update = $data_extended;
                 }
             }
         }
     }
     return $this->is_valid;
 }
Example #4
0
     //Загрузка сканов во вкладке финансовой информации
 //Загрузка сканов во вкладке финансовой информации
 case 'finance_doc':
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     $max_files = account::MAX_FILE_COUNT;
     $max_files_size = account::MAX_FILE_SIZE;
     $imageTypes = array(2, 3);
     //jpg,png
     $maxImageHeight = 3000;
     $maxImageWidth = 3000;
     $default_error = 'Файл не соответствует требованиям.';
     //Админ может загрузить сканы в директорию пользователя
     if (hasPermissions('users')) {
         $user_uid = __paramInit('striptrim', NULL, 'attachedfiles_uid');
         $hash = __paramInit('striptrim', NULL, 'attachedfiles_hash');
         if ($hash === paramsHash(array($user_uid)) && $uid != $user_uid) {
             require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
             $user = new users();
             $user->GetUserByUID($user_uid);
             if ($user->uid > 0) {
                 $login = $user->login;
             }
         }
     }
     $dir = sprintf(account::DOC_UPLOAD_PATH, $login);
     break;
     //@todo: данный вид загрузки сейчас вроде не используется, но был в старой СБР
 //@todo: данный вид загрузки сейчас вроде не используется, но был в старой СБР
 case 'finance_other':
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     $max_files = account::MAX_FILE_COUNT;
Example #5
0
            <table class="b-layout__table b-layout__table_width_full rez--itm1 rez--itm2 rez--itm3 rez--itm4">
            <tbody>
                <tr class="b-layout__tr">
                    <td class="b-layout__td b-layout__td_padtop_20 b-layout__td_width_200 b-layout__td_padbot_15 b-layout__td_width_full_iphone b-layout__td_pad_null_ipad">
                        <div class="b-layout__txt b-layout__txt b-layout__txt_padtop_5 b-layout__txt_padright_20">
                            Скан-копии страниц паспорта
                        </div>
                    </td>
                    <td id="attach_block" class="b-layout__td b-layout__td_padtop_20 b-layout__td_padbot_15 b-layout__td_padright_10 b-layout__td_width_full_iphone b-layout__td_pad_null_ipad">
<?php 
        // прикрепить скан
        $params = array('file_description' => '
                    Необходимы начальная страница с основными данными и страница с данными о адресе регистрации (если регистрация предусмотрена законодательством вашей страны).<br/> 
                    Допустимы четко различимые сканы (или фото) страниц в файлах формата jpg, jpeg или png.', 'button_title' => 'Прикрепить скан', 'new_interface' => true, 'css_class' => 'b-file_padbot_20', 'disabled' => $block_finance_edit, 'req_txt' => 'Разрешенные форматы: jpg, jpeg или png.', 'error' => isset($error['sbr']['err_attach']) ? $error['sbr']['err_attach'] : null);
        if ($is_adm) {
            $params['hiddens'] = array('uid' => $uid, 'hash' => paramsHash(array($uid)));
        }
        sbr::view_finance_files('finance_doc', $attachedFilesDoc, $attachDoc, $params);
        ?>
                    </td>
                </tr>
            </tbody>
            </table>
        </span>
<?php 
    }
    ?>
        <?php 
    if (!$block_finance_edit) {
        ?>
        <table class="b-layout__table b-layout__table_width_full">
Example #6
0
      <?php 
    if ($access_contacts) {
        ?>
          <?php 
        if ($user->isCurrent() || hasPermissions('users')) {
            include $_SERVER['DOCUMENT_ROOT'] . '/user/contacts_info.php';
        } else {
            ?>
          <div class="b-buttons b-buttons_center">
              <a id="show_contacts" 
                 data-login="******" 
                 data-hash="<?php 
            echo paramsHash(array($user->login));
            ?>
"
                 class="b-button b-button_flat b-button_flat_green" 
                 href="javascript:void(0);">
                  Показать контакты
              </a>
          </div>
          <?php 
        }
        ?>
      <?php 
    }
    ?>
      </td>
      <?php