예제 #1
0
 /**
  * Уведомления заказчику, если кандидат/победитель/исполнитель заблокирован на сайте
  * 
  * проект/конкурс/СБР - всего 5 видов уведомлений @see pmail::_ExecutorCandidateBanMail
  * 
  * @param  string|array $ids идентификаторы заблокированных пользователей
  * @param  resource $connect соединение к БД (необходимо в PgQ) или NULL -- создать новое
  * @return bool true - успех, false - провал
  */
 function ExecutorCandidateBanMail($ids, $connect = NULL)
 {
     if (empty($ids)) {
         return false;
     }
     $mRes = employer::GetEmployersBlockedCandidates($ids);
     if (!$GLOBALS['DB']->error && pg_num_rows($mRes)) {
         $nCurCnf = 1;
         $aRecipient = array();
         while ($aOne = pg_fetch_assoc($mRes)) {
             $aOne['name'] = htmlspecialchars($aOne['name'], ENT_QUOTES, 'CP1251', false);
             if ($nCurCnf != $aOne['cnf']) {
                 if ($aRecipient) {
                     $this->_ExecutorCandidateBanMail($nCurCnf, $aRecipient);
                     $aRecipient = array();
                 }
                 $nCurCnf = $aOne['cnf'];
             }
             if ($aOne['lnk'] == 'project') {
                 $sLink = $GLOBALS['host'] . getFriendlyURL('project', $aOne['id']);
             } elseif ($aOne['lnk'] == 'sbr') {
                 $sLink = $GLOBALS['host'] . '/' . sbr::NEW_TEMPLATE_SBR . '/?id=' . $aOne['id'];
             }
             $sUlink = $GLOBALS['host'] . '/users/' . $aOne['login'];
             $sUname = $aOne['uname'] . ' ' . $aOne['usurname'] . ' [' . $aOne['login'] . ']';
             $aRecipient[] = array('email' => $aOne['e_name'] . " " . $aOne['e_surname'] . " <" . $aOne['email'] . ">", 'extra' => array('name' => $aOne['name'], 'link' => $sLink, 'u_link' => $sUlink, 'u_name' => $sUname, 'USER_LOGIN' => $aOne['e_login']));
         }
         if ($aRecipient) {
             $this->_ExecutorCandidateBanMail($nCurCnf, $aRecipient);
         }
     }
 }