Example #1
0
 public function fetch($id)
 {
     $db = new Database();
     $eventTable = new EventTable();
     $eventTable->Create($db);
     $sql = "";
     if ($this->noItemsToFetch > 0) {
         $sql = "select *from " . EventTable::TableName . " where " . EventTable::CreatorId . " =:id  AND " . EventTable::Status . " > :zero ORDER BY " . EventTable::StartDate . " ASC LIMIT {$this->noItemsToFetch}";
     } else {
         $sql = "select *from " . EventTable::TableName . " where " . EventTable::CreatorId . " =:id ORDER BY " . EventTable::StartDate . " ASC";
     }
     $stmt = $db->prepare($sql);
     $stmt->bindValue(":zero", 0);
     $stmt->bindValue(":id", $id);
     $status = $stmt->execute();
     if ($status) {
         $rows = $stmt->fetchAll(Database::FETCH_ASSOC);
         for ($i = 0; $i < count($rows); $i++) {
             $rows[$i][EventTable::Image] = IMAGE_EVENT_PATHS . $rows[$i][EventTable::Image];
         }
         return $rows;
     } else {
         print_r($stmt->errorInfo());
     }
 }
Example #2
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->articles = ArticleTable::getInstance()->getArticlesForWeekmail()->execute();
     $this->events = EventTable::getInstance()->getEventsForWeekmail()->execute();
     $this->weekmails = WeekmailTable::getInstance()->getLast()->execute();
     $this->current_weekmails = WeekmailTable::getInstance()->getCurrent()->execute();
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $events = EventTable::getInstance()->getEventsWithin(100, 100, time());
 }
Example #4
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $event = EventTable::getInstance()->findUpComingEvent();
     $this->event = $event;
     $this->isUpComing = false;
     if ($event) {
         $this->isUpComing = true;
         // Start & end date
         $start = strtotime($event->getStartsAt());
         $finish = strtotime($event->getFinishesAt());
         $monthList = array(1 => 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
         setlocale(LC_TIME, 'fr_FR');
         if (strftime("%Y", $start) == strftime("%Y", $finish)) {
             if (strftime("%m", $start) == strftime("%m", $finish)) {
                 $this->startDate = strftime("%d", $start);
             } else {
                 $this->startDate = strftime("%d ", $start) . $monthList[strftime("%m", $start)];
             }
         } else {
             $this->startDate = strftime("%d " . $monthList[strftime("%m", $start)] . " %Y", $start);
         }
         $this->endDate = strftime("%d " . $monthList[strftime("%m", $finish)] . " %Y", $finish);
         // Start & end time
         $this->startTime = strftime("%H:%M", $start);
         $this->endTime = strftime("%H:%M", $finish);
         // Prize-pool
         $this->sum = 0;
         foreach ($event->getTournaments() as $tournament) {
             $this->sum += $tournament->getPrizePool();
             if ($tournament->getIsSubtournamentEnabled()) {
                 $this->sum += $tournament->getSubtournamentPrizePool();
             }
         }
     }
 }
 public function executeNew(sfWebRequest $request)
 {
     $this->event = new Event();
     //set Default Data
     $this->event->setParentClass($request->getParameter("parent_class"));
     $this->event->setParentId($request->getParameter("parent_id"));
     $parent = $this->event->getParent();
     //validate parent is not cancelled, do nothing
     if ($parent->isCancelled()) {
         $this->redirect("home/error?msg='Cannot create event. This transaction has been cancelled.'");
     }
     //validate parent is not fully paid
     if ($this->event->getParentClass() == "Invoice") {
         $invoice = $this->event->getParent();
         if ($invoice->getStatus() == "Paid") {
             //new invno not unique: error msg and quit
             $message = "Invoice is fully paid";
             $this->getUser()->setFlash('error', $message);
             return $this->redirect($request->getReferer());
         }
     }
     $this->event->setParentName($parent->getName());
     $this->event->setType($request->getParameter("type"));
     $this->event->setDate(MyDate::today());
     if ($request->getParameter("type") == "stockin" or $request->getParameter("type") == "stockout" or $request->getParameter("type") == "stocktrans") {
         EventTable::generate($this->event);
         $this->redirect($request->getReferer());
     }
     $this->form = $this->configuration->getForm($this->event);
 }
Example #6
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->tournaments = EventTable::getInstance()->findLastEvent()->getTournaments();
     foreach ($this->tournaments as $id => $tournament) {
         if ($tournament->getEmbeddedPlayer() == '' && $tournament->getBracketImage() == '') {
             $this->tournaments->remove($id);
         }
     }
 }
Example #7
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->blogArticles = ArticleTable::getInstance()->getFourLastArticles();
     $this->sliderArticles = ArticleTable::getInstance()->getFourLastSliderArticles();
     $event = EventTable::getInstance()->findUpComingEvent();
 }
Example #8
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->eventsList = EventTable::retrieveEventsList();
     $this->showList = EventTable::retrieveShowList();
     $this->betterShow = EventTable::retrieveBetterShow();
 }
 public function executeDsrmulti(sfWebRequest $request)
 {
     $requestparams = $request->getParameter("invoice");
     $day = $requestparams["date"]["day"];
     $month = $requestparams["date"]["month"];
     $year = $requestparams["date"]["year"];
     $invoice = new Invoice();
     if (!$day or !$month or !$year) {
         $invoice->setDate(MyDate::today());
     } else {
         $invoice->setDate($year . "-" . $month . "-" . $day);
     }
     $requestparams = $request->getParameter("purchase");
     $day = $requestparams["date"]["day"];
     $month = $requestparams["date"]["month"];
     $year = $requestparams["date"]["year"];
     $purchase = new Purchase();
     if (!$day or !$month or !$year) {
         $purchase->setDate(MyDate::today());
     } else {
         $purchase->setDate($year . "-" . $month . "-" . $day);
     }
     $this->form = new InvoiceForm($invoice);
     $this->toform = new PurchaseForm($purchase);
     $this->purchases = PurchaseTable::fetchByDateRange($invoice->getDate(), $purchase->getDate());
     $this->events = EventTable::fetchByDatenParentclass($purchase->getDate(), "Purchase");
     $this->cashsales = 0;
     $this->chequesales = 0;
     $this->creditsales = 0;
     $this->cashother = 0;
     $this->chequeother = 0;
     $this->creditother = 0;
     $this->cashtotal = 0;
     $this->chequetotal = 0;
     $this->credittotal = 0;
     $this->deducttotal = 0;
     foreach ($this->purchases as $purchase) {
         if ($purchase->getStatus() != "Cancelled") {
             $this->cashsales += $purchase->getCash();
             $this->chequesales += $purchase->getCheque();
             $this->creditsales += $purchase->getCredit();
             $this->cashtotal += $purchase->getCash();
             $this->chequetotal += $purchase->getCheque();
             $this->credittotal += $purchase->getCredit();
             //$this->deducttotal+=$purchase->getDsrdeduction();
         }
     }
     foreach ($this->events as $event) {
         $purchase = $event->getParent();
         if ($purchase->getStatus() != "Cancelled") {
             $this->cashother += $event->getDetail("cashamt");
             $this->chequeother += $event->getDetail("chequeamt");
             $this->creditother += $event->getDetail("creditamt");
             $this->cashtotal += $event->getDetail("cashamt");
             $this->chequetotal += $event->getDetail("chequeamt");
             $this->credittotal += $event->getDetail("creditamt");
             $this->deducttotal += $event->getDetail3();
         }
     }
     $this->total = $this->cashtotal + $this->chequetotal + $this->credittotal;
 }
Example #10
0
 /**
  * События какого-то юзера
  */
 public function executeUserEvents()
 {
     $user = $this->getRoute()->getObject();
     $events = EventTable::getInstance()->queryFeed()->andWhere('a.user_id = ?', $user->id)->limit(sfConfig::get('app_feeds_events_count', 30))->execute(array(), Doctrine::HYDRATE_ARRAY);
     $this->buildFeed($events, array('title' => sprintf('События пользователя %s | НеСкучайк!', $user->username), 'permalink_url' => 'event_show'));
 }
Example #11
0
 public function executePermalink(sfWebRequest $request)
 {
     //Asignaciones
     $this->vipSlug = 'club-magic';
     $this->level = $request->getParameter('level');
     $slug = $request->getParameter('slug');
     $this->currentPage = Doctrine::getTable('Page')->findOneBySlug($slug);
     $user = $this->getUser();
     //usuarios de paginas vip
     if ($user->isAuthenticated()) {
         $this->isVip = $user->getGuardUser()->hasPermission('Vip');
     } else {
         $this->isVip = false;
     }
     $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfMooDooFormSignin');
     $this->form = new $class();
     //si es pagina vip y no es vip redirecciona
     if ($this->currentPage->getParent()->getSlug() == $this->vipSlug and !$this->isVip) {
         return $this->redirect('@page_child_slug?parentslug=' . $request->getParameter('parentslug') . '&slug=' . $request->getParameter('slug') . '&level=1');
     } else {
         // paginas hijas
         if ($this->level == 1 || $this->level == 2) {
             // VIP estando logueado como vip
             if ($request->getParameter('slug') == $this->vipSlug) {
                 if ($request->isMethod('post')) {
                     $this->form->bind($request->getParameter('signin'));
                     if ($this->form->isValid()) {
                         $values = $this->form->getValues();
                         $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
                         return $this->redirect('@page_child_slug?parentslug=' . $request->getParameter('parentslug') . '&slug=' . $request->getParameter('slug') . '&level=1');
                     }
                 }
             }
             // end login in page Vip
             if ($this->level == 1 || $this->level == 2) {
                 $this->childPage = Doctrine::getTable('Page')->findOneBySlug($slug);
             }
             $this->page = $this->childPage->getParent();
             $this->grandParent = $this->page->getParent();
             if ($this->grandParent == '' || $this->grandParent == NULL) {
                 $this->grandParent = false;
             }
             // Paginas hijas de show
             if ($this->page->get('slug') == 'espectaculos') {
                 $this->catSlug = $slug;
                 $catId = Doctrine::getTable('category')->findOneBySlug($this->catSlug)->getId();
                 $this->mainShow = EventTable::retrieveMainShow($catId);
                 $this->shows = EventTable::retrieveShows($catId);
                 $this->setTemplate('shows');
             }
         } else {
             $this->page = Doctrine::getTable('Page')->findOneBySlug($slug);
             $this->childPage = false;
             $this->grandParent = false;
         }
         // pagina de show
         if ($slug == 'espectaculos') {
             $this->catSlug = $slug;
             $this->mainShow = EventTable::retrieveMainShow();
             $this->shows = EventTable::retrieveShows();
             $this->setTemplate('shows');
         }
     }
 }
Example #12
0
 public function executeCountbox()
 {
     $this->event = EventTable::getInstance()->findUpComingEvent();
 }
Example #13
0
 public function executeEvents()
 {
     $this->events = EventTable::getInstance()->getFutureEventsList(4, $this->asso)->execute();
 }
 public function executeDsrmulti(sfWebRequest $request)
 {
     $requestparams = $request->getParameter("invoice");
     $day = $requestparams["date"]["day"];
     $month = $requestparams["date"]["month"];
     $year = $requestparams["date"]["year"];
     $invoice = new Invoice();
     if (!$day or !$month or !$year) {
         $invoice->setDate(MyDate::today());
     } else {
         $invoice->setDate($year . "-" . $month . "-" . $day);
     }
     $requestparams = $request->getParameter("purchase");
     $day = $requestparams["date"]["day"];
     $month = $requestparams["date"]["month"];
     $year = $requestparams["date"]["year"];
     $purchase = new Purchase();
     if (!$day or !$month or !$year) {
         $purchase->setDate(MyDate::today());
     } else {
         $purchase->setDate($year . "-" . $month . "-" . $day);
     }
     $this->form = new InvoiceForm($invoice);
     $this->toform = new PurchaseForm($purchase);
     $this->invoices = InvoiceTable::fetchByDateRange($invoice->getDate(), $purchase->getDate());
     $this->events = EventTable::fetchByDatenParentclass($invoice->getDate(), "Invoice");
     $this->cashsales = 0;
     $this->chequesales = 0;
     $this->creditsales = 0;
     $this->cashother = 0;
     $this->chequeother = 0;
     $this->creditother = 0;
     $this->cashtotal = 0;
     $this->chequetotal = 0;
     $this->credittotal = 0;
     $this->deducttotal = 0;
     $this->templates = Doctrine_Query::create()->from('InvoiceTemplate t')->orderBy('id')->execute();
     //calculations start
     //no tmc so, no lesley, no interoffice
     foreach ($this->templates as $template) {
         //end no tmc so, no lesley, no interoffice
         foreach ($this->invoices as $invoice) {
             if ($invoice->getIsTemporary() == 0) {
                 if ($invoice->getTemplateId() == $template->getId()) {
                     if ($invoice->getStatus() != "Cancelled") {
                         if ($invoice->getHidden() == 0) {
                             $this->cashsales += $invoice->getCash();
                             $this->chequesales += $invoice->getChequeamt();
                             $this->creditsales += $invoice->getCredit();
                             $this->cashtotal += $invoice->getCash();
                             $this->chequetotal += $invoice->getChequeamt();
                             $this->credittotal += $invoice->getCredit();
                             $this->deducttotal += $invoice->getDsrdeduction();
                         }
                     }
                 }
             }
         }
         //no tmc so, no lesley, no interoffice
     }
     //end no tmc so, no lesley, no interoffice
     /*
     //hide events
           foreach($this->events as $event)
           {
             $invoice=$event->getParent();
             if($invoice->getStatus()!="Cancelled")
             {
               $this->cashother+=$event->getDetail("cashamt");
               $this->chequeother+=$event->getDetail("chequeamt");
               $this->creditother+=$event->getDetail("creditamt");
               $this->cashtotal+=$event->getDetail("cashamt");
               $this->chequetotal+=$event->getDetail("chequeamt");
               $this->credittotal+=$event->getDetail("creditamt");
               $this->deducttotal+=$event->getDetail3();
             }
           }
     */
     $this->total = $this->cashtotal + $this->chequetotal + $this->credittotal;
 }
Example #15
0
 /**
  * Receives the uploaded file and processes it as events for the logged in person.
  * @param sfWebRequest $request
  */
 private function processUpload(&$form)
 {
     $user = $this->getUser();
     $personId = $user->getPersonId();
     //get the file from the upload.
     $file = $form->getValue('upload');
     //get the extension and set the file name based on person logged in.
     $extension = $file->getExtension($file->getOriginalExtension());
     $filename = 'uploaded_' . $personId;
     //save the file on disk, for reading next.
     $fullDir = sfConfig::get('sf_upload_dir') . '/ical';
     $fullFileName = $filename . $extension;
     $fullFilePath = $fullDir . '/' . $fullFileName;
     $file->save($fullFilePath);
     //after the file has been saved, go and read it into the events table.
     $this->eventCount = EventTable::getInstance()->setEventsFromICal($fullDir, $fullFileName, $personId);
     // We should probably remove the file here.
 }
Example #16
0
 public function executeLastEvents()
 {
     $this->events = EventTable::getInstance()->getLastEvents(4)->execute();
 }
Example #17
0
 /**
  * Актульаные события места
  *
  * @param integer $max
  * @return Doctrine_Collection
  */
 public function getActualEvents($max = false)
 {
     $q = EventTable::getInstance()->queryActive();
     return EventTable::getInstance()->queryWithCount($q)->andWhere($q->getRootAlias() . '.place_id = ?', (int) $this->getId())->limit($max)->execute();
 }
Example #18
0
 protected function forwardClosedIfNoEventUpcoming()
 {
     $event = EventTable::getInstance()->findUpComingEvent();
     $this->ForwardUnless($event and $event->getIsOpened() and $event->getTournaments()->count() > 0, "registration", "closed");
 }
Example #19
0
 public function executeUnregister(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $this->forward404Unless($event = EventTable::getInstance()->find(array($request->getParameter('id'))), sprintf('Object event does not exist (%s).', $request->getParameter('id')));
     if (!$this->getUser()->isAuthenticated()) {
         $this->getUser()->setFlash('error', 'Vous devez vous connecter afin d\'effectuer cette action.');
         $this->redirect('event/show?id=' . $event->getId());
     }
     $em = EventMemberTable::getInstance()->getEventMember($event->getId(), $this->getUser()->getGuardUser()->getId())->execute();
     $em->delete();
     $this->redirect('event/show?id=' . $event->getId());
 }
Example #20
0
 /**
  * Я передумал :-/
  */
 public function executeUnfollow(sfWebRequest $request)
 {
     $event = $this->getRoute()->getObject();
     $user = $this->getUser()->getGuardUser();
     if ($accept = $event->hasFollower($user->id)) {
         $accept->delete();
     }
     // обновить событие
     $event = EventTable::getInstance()->findOneById($event->id);
     if ($request->isXmlHttpRequest()) {
         return $this->renderPartial('event/show', array('event' => $event, 'move' => false));
     } else {
         return $this->redirect('event_show', $event);
     }
 }
Example #21
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form_vals = $this->form->getValues();
         $event = EventTable::getInstance()->find($form_vals["event_id"]);
         if ($event->userIsPhotographer($this->getUser())) {
             $galerie_photo = $form->save();
             $this->redirect('galerie/show?id=' . $galerie_photo->getId());
         }
     }
 }
Example #22
0
 public function executeEvents()
 {
     $this->asso = $this->getRoute()->getObject();
     $this->redirectUnless($this->asso, 'assos_list');
     $this->events = EventTable::getInstance()->getEventsList($this->asso)->execute();
 }