示例#1
0
 public static function notifyLosers($project)
 {
     $deniedOffers = Offer::getOfferByProjectId($project->pro_id, Offer::STATUS_NOT_AWARDED);
     foreach ($deniedOffers as $denied) {
         $notifyData = new \stdClass();
         $notifyData->project_id = $project->pro_id;
         $notifyMsg = 'Tu oferta para el proyecto ' . $project->pro_tit . ' no fue seleccionada';
         $notifyData = json_encode($notifyData);
         $result = Notification::create($denied->user_id, $notifyMsg, Notification::TYPE_DENIED_OFFER, $notifyData);
         if (!$result) {
             //log here
         }
     }
 }
示例#2
0
    $notificationData->project_id = $rs_user_of->pro_id;
    //TODO sin comentarios!! email, notificaciones todo mezclado, los if $_cookie, rehacer todo piedad!!!
    if ($_COOKIE['id'] == $rs_user_of->user_id) {
        //SI es el cliente
        $completeName = $us_of['full_name'];
        $to = $us_pro['email'];
        $asunto = "Has recibido un comentario en una oferta";
        $mailCont = '</strong> ha comentado en su oferta, en el proyecto "<span style="color:#cc6600; font-weight:bold;">' . $rs_user_pro->pro_tit . '</span>". Para ver el comentario haz click <a href="' . FConfig::getUrl('proyecto') . '?id=' . $rs_user_pro->pro_id . '" target="_blank">aquí</a>.';
        $not_user = Notification::create($us_pro['id'], 'Has recibido un mensaje de ' . $completeName, Notification::TYPE_COMMENT, json_encode($notificationData));
    } else {
        if ($_COOKIE['id'] == $rs_user_pro->user_id) {
            $completeName = $us_pro['full_name'];
            $to = $us_of['email'];
            $asunto = "Has recibido un comentario en una de tus ofertas";
            $mailCont = '</strong> ha comentado en tu oferta, en el proyecto "<span style="color:#cc6600; font-weight:bold;">' . $rs_user_pro->pro_tit . '</span>". Para ver el comentario haz click <a href="' . FConfig::getUrl('proyecto') . '?id=' . $rs_user_pro->pro_id . '" target="_blank">aquí</a>.';
            $not_user = Notification::create($us_of['id'], 'Has recibido un mensaje de ' . $completeName, Notification::TYPE_COMMENT, json_encode($notificationData));
        }
    }
    //End notification
    $sender_us = getUserInfo($_COOKIE['id']);
    $params = array('site_url' => FConfig::getUrl('site_url'), 'logo_url' => FConfig::getUrl('images/logo_footer.png'), 'user_name' => $completeName, 'comment_name' => $sender_us['name'] . ' ' . $sender_us['lastname'], 'content' => $mailCont);
    $body = FMailer::replaceParameters($params, file_get_contents('../views/emails/comentarioOfertaEmail.html'));
    $mailer = new FMailer();
    $receivers = array(array('email' => $to));
    $mailer->setReceivers($receivers);
    $mailer->sendEmail($asunto, $body);
    $arreglo[] = array('resp' => "Se ha enviado la información");
    echo json_encode($arreglo);
}
if ($act == "validarPago") {
    $pro_id = $_REQUEST['pro_id'];