Exemplo n.º 1
0
 public function testInvitarAmigo()
 {
     $app = new App();
     //        $fAnalytics = $app->getHelper('FAnalytics');
     /** @var $ga \Fototea\Util\Analytics; */
     $ga = FAnalytics::getInstance();
     $this->assertNotNull($ga);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por twitter', 99);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por facebook', 98);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por twitter', 97);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por facebook', 96);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por twitter', 99);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por twitter', 95);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por email', 94);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por email', 99);
     //        $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por googleplus', 93);
     $ga->trackEvent('Referidos - Invitar Amigos', 'Invitar por googleplus', 93);
     //        $ga->trackEvent()
 }
Exemplo n.º 2
0
 public static function adjudicateProject($projectId, $offerId)
 {
     $userFields = array(User::PROFILE_DIRECTION, User::PROFILE_MOVIL, User::PROFILE_CITY);
     //Load proyect and offer
     $project = Project::loadById($projectId);
     $projectOwner = User::getUserInfo($project->user_id, $userFields);
     if (Project::canBeAdjudicated($project)) {
         $offer = Offer::getOffer($offerId);
         $winner = User::getUserInfo($offer->user_id, $userFields);
         //Set project as adjudicated
         $data = array('pro_status' => Project::PROJECT_STATUS_ADJUDICATED, 'pro_date_end' => date('Y-m-d H:i:s', time()));
         Project::updateProject($project->pro_id, $data);
         //Set offer as winner
         $data = array('awarded' => Offer::STATUS_AWARDED);
         Offer::updateOffer($offer->id, $data);
         //Send notificacions and emails
         self::notifyWinner($project, $projectOwner, $winner);
         // Send email to winner
         self::emailWinner($offer, $winner, $project, $projectOwner);
         // Send email to project owner
         self::emailProjectOwner($offer, $winner, $project, $projectOwner);
         // Notifiy other photographers about denied offers. Losers :D
         self::notifyLosers($project);
         //Track event in analytics
         // Event = Proyectos adjudicados
         $eventData = new \stdClass();
         $eventData->user_id = $projectOwner['id'];
         $eventData->photograph_id = $winner['id'];
         $eventData->project_name = $project->pro_tit;
         $events = FAnalytics::getInstance();
         $events->trackEvent('Proyecto', 'Proyectos adjudicados', json_encode($eventData));
     } else {
         //TODO Oh oh... strong notification here about this fail
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
    $mailer->setReceivers($receivers);
    $mailer->sendEmail($asunto, $body);
    // Enviar correo a cliente
    $asunto = "Has adjudicado un proyecto. ¡Buen Trabajo!";
    $params = array('site_url' => FConfig::getUrl(), 'logo_url' => FConfig::getUrl('images/logo_footer.png'), 'check_url' => FConfig::getUrl('images/check_green.gif'), 'client_name' => $clientUser['name'] . ' ' . $clientUser['lastname'], 'oferta_winner' => $rs_oferta->bid, 'proyecto_titulo' => $rs_proj->pro_tit, 'projecto_date' => DateHelper::getShortDate($rs_proj->pro_date), 'proyecto_url' => FConfig::getUrl('proyecto') . '?id=' . $id_pr, 'photograph_name' => $photographUser['name'] . ' ' . $photographUser['lastname'], 'photograph_email' => $photographUser['email'], 'photograph_phone' => $photographUser['movil'], 'photograph_location' => $photographUser['ciudad'] . ', ' . $photographUser['direccion']);
    $body = FMailer::replaceParameters($params, file_get_contents('../views/emails/adjudicarProyectosClienteEmail.html'));
    $mailer = new FMailer();
    $receivers = array(array('email' => $clientUser['email']));
    $mailer->setReceivers($receivers);
    $mailer->sendEmail($asunto, $body);
    // Event = Proyectos adjudicados
    $eventData = new stdClass();
    $eventData->user_id = $user_pro;
    $eventData->photograph_id = $photographUser['id'];
    $eventData->project_name = $rs_proj->pro_tit;
    $events = FAnalytics::getInstance();
    $events->trackEvent('Proyecto', 'Proyectos adjudicados', json_encode($eventData));
    $arreglo[] = array('resp' => "Se ha enviado la información");
    echo json_encode($arreglo);
}
if ($act == "finalizar") {
    /* Cambiar el estus del proyecto a FC y FF */
    $current_user = getCurrentUser();
    $us_id = $_GET['us'];
    $us_info = getUserInfo($us_id);
    $type_us = $_GET['us_type'];
    $comment = preg_replace("/\n/", "<br/>", $_GET['comment']);
    $finish = $_GET['finish'];
    $pro_id = $_GET['pro'];
    // guardar status fin del usuario
    insertTable("proyecto_fin", "'','{$pro_id}','{$current_user->id}','S',NOW()");