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 } } }
<?php use Fototea\Models\User; use Fototea\Models\Project_View; use Fototea\Util\DateHelper; use Fototea\Models\Project; use Fototea\Models\Offer; use Fototea\Util\UrlHelper; ?> <?php if ($current_user->user_type != User::USER_TYPE_PHOTOGRAPHER) { die('invalid tab'); } $projects = Project_View::loadProjectsByStatus(array(Project::PROJECT_STATUS_ACTIVE)); $offers = Offer::getUserOffers($current_user->id, array()); $result = array(); foreach ($offers as $offer) { if (isset($offer->pro_id)) { $result[$offer->pro_id] = $offer; } } $offers = $result; //var_dump($offers); ?> <div class="containerPerfil projects-tab-photograph"> <div class="list-container"> <div class="list-header"> <div class="col-xs-2">Proyectos Nuevos</div> <div class="col-xs-6">Descripción del proyecto</div>
// endif; //valida que el usuario que visita no haya hecho una oferta antes al proyecto $oferta_user = listAll("ofertas", "WHERE pro_id = '{$id_pro}' AND user_id = '{$current_user->id}'"); $rows_oferta = mysql_num_rows($oferta_user); if ($rows_oferta > 0) { $ofertas = "S"; } else { $ofertas = "N"; } //busca la oferta bas baja $oferta_baja = listAll("ofertas", "WHERE pro_id = '{$id_pro}' ORDER BY bid ASC LIMIT 0,1"); $rows_ob = mysql_fetch_object($oferta_baja); $winnerOffer = null; $winnerOfferOwner = null; if ($rs_pro->oferta_adjudicada_id) { $winnerOffer = Offer::getOffer($rs_pro->oferta_adjudicada_id); $winnerOfferOwner = getUserInfo($rs_pro->oferta_user_id); } $currentUserOffer = listAll("ofertas", "WHERE pro_id = '{$id_pro}' AND user_id = '{$current_user->id}'"); $currentUserOffer = mysql_fetch_object($currentUserOffer); ?> <script src="<?php echo FConfig::getUrl('js/popModal.js'); ?> "></script> <div class="project-info clearfix"> <h2 class="main-title"> <?php