/**
  * shows the homepage
  *
  */
 public function indexAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (isset($get->shelf)) {
         $this->view->hideFeature = true;
     }
     $event = new Event();
     $upcoming = $event->getEvents(null, null, null, time(), null, 'open', 5)->toArray();
     $workshop = new Workshop();
     foreach ($upcoming as &$u) {
         $u['workshop'] = $workshop->find($u['workshopId'])->toArray();
         if (Zend_Auth::getInstance()->hasIdentity()) {
             $u['status'] = $event->getStatusOfUserForEvent(Zend_Auth::getInstance()->getIdentity()->accountId, $u['eventId']);
         } else {
             $u['status'] = '';
         }
     }
     $this->view->upcoming = $upcoming;
     $searchTerm = new Search_Term();
     $this->view->popularSearchTerms = $searchTerm->getTopSearchTerms(5)->toArray();
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->view->loggedIn = true;
         $myEvents = $event->getEventsForUser(Zend_Auth::getInstance()->getIdentity()->accountId);
         $this->view->myEvents = $myEvents['currentEvents'];
         $this->view->account = Zend_Auth::getInstance()->getIdentity()->toArray();
     }
     $this->_helper->layout->setLayout('homepage');
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
 }
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $checkDtStart = new Zend_Date($this->_lastRunDt);
     $checkDtStart->subHour($config->user->numHoursEvaluationReminder->val);
     $checkDtEnd = new Zend_Date();
     $checkDtEnd->subHour($config->user->numHoursEvaluationReminder->val);
     $event = new Event();
     $events = $event->getEvents(null, null, null, $checkDtStart->getTimestamp(), $checkDtEnd->getTimestamp(), 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendee = new Event_Attendee();
     $eu = new Evaluation_User();
     foreach ($events as $e) {
         $startDt = strtotime($e->date . ' ' . $e->startTime);
         $endDt = strtotime($e->date . ' ' . $e->endTime);
         if ($checkDtStart->getTimestamp() < $endDt && $checkDtEnd->getTimestamp() >= $endDt) {
             $evalAvailableDt = new Zend_Date($endDt);
             $evalAvailableDt->addHour($config->user->numHoursEvaluationAvailability->val);
             if ($evalAvailableDt->getTimestamp() > time()) {
                 $taken = $eu->getCompleted($e->eventId);
                 $thisLocation = $location->find($e->locationId);
                 if (is_null($thisLocation)) {
                     throw new Ot_Exception_Data('msg-error-noLocation');
                 }
                 $thisWorkshop = $workshop->find($e->workshopId);
                 if (is_null($thisWorkshop)) {
                     throw new Ot_Exception_Data('msg-error-noWorkshop');
                 }
                 $instructors = $instructor->getInstructorsForEvent($e->eventId);
                 $instructorNames = array();
                 $instructorEmails = array();
                 foreach ($instructors as $i) {
                     $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                     $instructorEmails[] = $i['emailAddress'];
                 }
                 $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
                 $attending = $attendee->getAttendeesForEvent($e->eventId, 'attending');
                 foreach ($attending as $a) {
                     if ($a['attended'] == 1 && !in_array($a['accountId'], $taken)) {
                         $trigger = new Ot_Trigger();
                         $trigger->setVariables($data);
                         $trigger->accountId = $a['accountId'];
                         $trigger->studentEmail = $a['emailAddress'];
                         $trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
                         $trigger->studentUsername = $a['username'];
                         $trigger->dispatch('Event_Evaluation_Reminder');
                     }
                 }
             }
         }
     }
 }
Exemple #3
0
 public function getReportCsv($fromDate, $toDate)
 {
     $event = new Event();
     $workshop = new Workshop();
     $location = new Location();
     $attendee = new Event_Attendee();
     // go ahead and get all the workshops so we don't have to do loads of DB queries
     $workshopList = $workshop->fetchAll();
     $workshops = array();
     foreach ($workshopList as $w) {
         $workshops[$w->workshopId] = $w->toArray();
     }
     // go ahead and get all the locations so we don't have to do loads of DB queries
     $locationList = $location->fetchAll();
     $locations = array();
     foreach ($locationList as $l) {
         $locations[$l->locationId] = $l->toArray();
     }
     $events = $event->getEvents(null, null, null, $fromDate, $toDate)->toArray();
     $fileName = 'report-' . date('Ymd-B') . '.csv';
     $tmpName = tempnam('/tmp', $fileName);
     $fp = fopen($tmpName, 'w');
     $columnNames = array('eventId' => 'eventId', 'workshopId' => 'workshopId', 'workshopTitle' => 'workshopTitle', 'locationId' => 'locationId', 'locationName' => 'locationName', 'eventDate' => 'eventDate', 'startTime' => 'startTime', 'endTime' => 'endTime', 'accountId' => 'accountId', 'username' => 'username', 'firstName' => 'firstName', 'lastName' => 'lastName', 'status' => 'status', 'attended' => 'attended');
     $ret = fputcsv($fp, $columnNames, ',', '"');
     if ($ret === false) {
         throw new Ot_Exception_Data('Error writing backup CSV file');
     }
     foreach ($events as &$e) {
         $e['workshop'] = $workshops[$e['workshopId']];
         $e['location'] = $locations[$e['locationId']];
         $e['attendees'] = $attendee->getAttendeesForEvent($e['eventId']);
         foreach ($e['attendees'] as $a) {
             $data = array();
             $data = array('eventId' => $e['eventId'], 'workshopId' => $e['workshopId'], 'workshopTitle' => $e['workshop']['title'], 'locationId' => $e['locationId'], 'locationName' => $e['location']['name'], 'eventDate' => $e['date'], 'startTime' => $e['startTime'], 'endTime' => $e['endTime'], 'accountId' => $a['accountId'], 'username' => $a['username'], 'firstName' => $a['firstName'], 'lastName' => $a['lastName'], 'status' => $a['status'], 'attended' => $a['attended']);
             $ret = fputcsv($fp, $data, ',', '"');
             if ($ret === false) {
                 throw new Ot_Exception_Data('Error writing backup CSV file');
             }
         }
     }
     fclose($fp);
     file_get_contents($tmpName);
     header('Content-Description: File Transfer');
     header('Content-Type: application/octet-stream');
     header('Content-Length: ' . filesize($tmpName));
     header("Content-Disposition: attachment; filename={$fileName}");
     readfile($tmpName);
     unlink($tmpName);
 }
 /**
  * reindexes the selected search index
  *
  */
 public function reindexAction()
 {
     $form = Ot_Form_Template::delete('reindex', 'search-index-reindex:reindex');
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         set_time_limit(0);
         $workshop = new Workshop();
         $workshops = $workshop->fetchAll();
         foreach ($workshops as $w) {
             $workshop->index($w);
         }
         $this->_helper->flashMessenger->addMessage('msg-info-reindexed');
         $this->_redirect('/');
     }
     $this->view->form = $form;
     $this->_helper->pageTitle('search-index-reindex:title');
 }
Exemple #5
0
 public function run()
 {
     $items = \Workshop::get_all()->fetch();
     for ($i = count($items); $i < 8; $i++) {
         $items[] = new \Workshop(array("name" => "Připravujeme", "desc" => 'Workshop ' . ($i + 1)));
     }
     $this->partial('pages/workshops', array("items" => $items));
 }
 public function actionWorkshops()
 {
     $plannedWorkshopData = WorkshopPlanned::getPlannedWorkshops();
     $workshopData = Workshop::getUpcomingWorkshops();
     /*$workshopData->pagination = new CPagination(self::listingsPerPage);*/
     $this->breadcrumbs = array('Workshops');
     $this->tabMenus = array(array('label' => 'Articles', 'url' => array('/site/articles')), array('label' => 'News', 'url' => array('/site/news')), array('label' => 'Events', 'url' => array('/event/event/index')), array('label' => 'Workshops', 'active' => true));
     $this->render('workshops', array('plannedWorkshopData' => $plannedWorkshopData, 'workshopData' => $workshopData));
 }
 public function run()
 {
     $ws = \Workshop::get_all()->where(array('visible' => true))->fetch();
     foreach ($ws as $w) {
         $w->ass_total = $w->assignees->count();
         $w->ass_all = $w->assignees->fetch();
     }
     $this->partial('stats/workshops', array("workshops" => $ws));
 }
 public function postEdit()
 {
     $param = Input::all();
     $workshop = Workshop::findOrFail($param['id']);
     $workshop->title = $param['title'];
     $workshop->content = $param['content'];
     $workshop->latitude = $param['latitude'];
     $workshop->longitude = $param['longitude'];
     $workshop->save();
     return Redirect::action('WorkshopController@index');
 }
 public function run()
 {
     $account_pay = \Workshop\Check::get_all()->reset_cols()->add_cols(array('SUM(amount) as `total`'))->where(array("is_paid" => false))->assoc_with(null)->fetch_one();
     $account_sum = \Workshop\Payment::get_all()->reset_cols()->add_cols(array('SUM(amount) as `total`'))->assoc_with(null)->fetch_one();
     $stats = array("total" => \Workshop\SignUp::get_all()->count(), "unpaid" => \Workshop\SignUp::get_all()->where(array('paid' => false, 'solved' => false))->count(), "paid" => \Workshop\SignUp::get_all()->where(array('paid' => true))->count(), "waiting" => \Workshop\SignUp::get_all()->where(array('paid' => true, 'solved' => false, 'canceled' => false))->count(), "solved" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'canceled' => false))->count(), "meals" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'lunch' => true, 'canceled' => false))->count(), "hotel" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'hotel' => true, 'canceled' => false))->count(), "expected_cnt" => \Workshop\Check::get_all()->where(array("is_paid" => false))->count(), "expected_sum" => $account_pay['total'], "received_cnt" => \Workshop\Payment::get_all()->count(), "received_sum" => $account_sum['total']);
     $ws = \Workshop::get_all()->fetch();
     foreach ($ws as $w) {
         $w->sig_total = $w->signups->count();
         $w->ass_total = $w->assignees->count();
     }
     $this->partial('stats/signups', array("stats" => $stats, "workshops" => $ws));
 }
 public function getEventsForInstructor($accountId, $startDt = null, $endDt = null)
 {
     $dba = $this->getAdapter();
     $where = $dba->quoteInto('accountId = ?', $accountId);
     $result = $this->fetchAll($where);
     $eventIds = array();
     foreach ($result as $r) {
         $eventIds[] = $r->eventId;
     }
     if (count($eventIds) == 0) {
         return array();
     }
     $event = new Event();
     $workshop = new Workshop();
     $events = $event->getEvents(null, $eventIds, null, $startDt, $endDt, 'open')->toArray();
     foreach ($events as &$e) {
         $e['workshop'] = $workshop->find($e['workshopId']);
         //->toArray();
     }
     return $events;
 }
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $event = new Event();
     $events = $event->getEvents(null, null, null, time(), null, 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $checkDt = new Zend_Date($this->_lastRunDt);
     $checkDt->addHour($config->user->numHoursLowAttendanceNotification->val);
     foreach ($events as $e) {
         if ($e->roleSize < $e->minSize) {
             $startDt = strtotime($e->date . ' ' . $e->startTime);
             $endDt = strtotime($e->date . ' ' . $e->endTime);
             if ($checkDt->getTimestamp() > $startDt && $this->_lastRunDt < $startDt) {
                 $thisLocation = $location->find($e->locationId);
                 if (is_null($thisLocation)) {
                     throw new Ot_Exception_Data('msg-error-noLocation');
                 }
                 $thisWorkshop = $workshop->find($e->workshopId);
                 if (is_null($thisWorkshop)) {
                     throw new Ot_Exception_Data('msg-error-noWorkshop');
                 }
                 $instructors = $instructor->getInstructorsForEvent($e->eventId);
                 $instructorNames = array();
                 $instructorEmails = array();
                 foreach ($instructors as $i) {
                     $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                     $instructorEmails[] = $i['emailAddress'];
                 }
                 $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
                 $trigger = new Ot_Trigger();
                 $trigger->setVariables($data);
                 $trigger->dispatch('Event_LowAttendance');
             }
         }
     }
 }
 public function __construct($scenario = '', $id = null, $checkApproved = false)
 {
     if ($scenario == 'view' && $id != null) {
         $this->workshop = Workshop::getWorkshop($id, $checkApproved);
         //model()->with('postItem')->findByPk($id);
         $this->workshopFile = $this->workshop->workshop_file;
         if ($this->workshop != null) {
             $this->postItem = $this->workshop->postItem;
         } else {
             throw new CHttpException(400, 'Cannot found the event post.');
         }
     } else {
         $this->_new();
     }
 }
 public function cmd_workshops()
 {
     \System\Init::full();
     $ws = \Workshop::get_all()->fetch();
     $dump = array();
     foreach ($ws as $workshop) {
         $signups = $workshop->assignees->where(array("solved" => true))->fetch();
         array_push($dump, $workshop->name, "------\n");
         foreach ($signups as $signup) {
             array_push($dump, $signup->toName() . ': ' . $signup->email . ' ' . $signup->phone);
         }
         array_push($dump, "\n");
     }
     echo implode("\n", $dump);
 }
Exemple #14
0
 public function mail_reassignment($op)
 {
     $prev = null;
     if (!$op) {
         return $this;
     }
     if (isset($this->data_initial['id_assigned_to'])) {
         $prev = \Workshop::find($this->data_initial['id_assigned_to']);
     }
     $pref = $this->workshops->sort_by('id_workshop_signup_has_workshop')->fetch();
     $ren = new \System\Template\Renderer\Txt();
     $ren->reset_layout();
     $ren->partial('mail/signup/assignment', array("item" => $this, "op" => $op, "ws" => $this->assigned_to, "prev" => $prev, "pref" => $pref));
     $mail = new \Helper\Offcom\Mail(array('rcpt' => array($this->email), 'subject' => 'Improtřesk 2016 - Přihláška, zařazení na workshop', 'reply_to' => \System\Settings::getSafe(array('offcom', 'default', 'reply_to'), null), 'message' => $ren->render_content()));
     $mail->send();
 }
 public function run()
 {
     if (Yii::app()->request->isAjaxRequest && isset($_GET['q'])) {
         $title = Yii::app()->request->getParam('q', '');
         $limit = Yii::app()->request->getParam('limit', 50);
         $limit = min($limit, 50);
         $criteria = new CDbCriteria();
         $criteria->condition = "title LIKE :sterm";
         $criteria->params = array(":sterm" => "%{$title}%");
         $criteria->limit = $limit;
         $array = Workshop::model()->findAll($criteria);
         $result = '';
         foreach ($array as $val) {
             $result .= $val->getAttribute('title') . '|' . $val->getAttribute('id') . "\n";
         }
         echo $result;
     }
 }
Exemple #16
0
 public static function make_a_comment_to(ORM $object, $insertion_user, $title, $content, $moderated_state = 'DEFAULT', Comment_Model $in_reply_to = NULL, $url_identifier = '')
 {
     $comment_to_insert = ORM::factory('comment');
     $comment_to_insert->commented_object = $object;
     $comment_to_insert->insertion_user_id = $insertion_user->id;
     Workshop::factory()->add_as_author_of($insertion_user, $object);
     $comment_to_insert->title = $title;
     $comment_to_insert->content = $content;
     $comment_to_insert->moderated_state = $moderated_state;
     if ($in_reply_to != NULL) {
         $comment_to_insert->in_reply_to_id = $in_reply_to->id;
     }
     if ($url_identifier == '') {
         $url_identifier = comments::make_url_identifier($comment_to_insert);
     }
     $comment_to_insert->url_identifier = url_identifier::get_next_available_url_identifier($comment_to_insert, $url_identifier);
     $comment_to_insert->save();
 }
Exemple #17
0
 public function get_form()
 {
     $opts = array();
     $f = $this->response->form();
     $ws = \Workshop::get_all();
     foreach ($ws as $w) {
         $opts[$w->id] = $w->name;
     }
     $f->input(array('name' => 'name_first', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'name_last', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'team', 'type' => 'text', 'required' => false));
     $f->input(array('name' => 'email', 'type' => 'email', 'required' => true));
     $f->input(array('name' => 'phone', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'birthday', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'lunch', 'type' => 'checkbox', 'required' => false));
     $f->input(array('name' => 'hotel', 'type' => 'checkbox', 'required' => false));
     $f->input(array('name' => 'workshop_0', 'type' => 'select', 'options' => $opts, 'required' => true));
     $f->input(array('name' => 'workshop_1', 'type' => 'select', 'options' => $opts));
     $f->input(array('name' => 'workshop_2', 'type' => 'select', 'options' => $opts));
     $f->input(array('name' => 'rules', 'type' => 'checkbox', 'required' => true));
     $f->input(array('name' => 'newsletter', 'type' => 'checkbox', 'required' => false));
     return $f;
 }
Exemple #18
0
 public function getWeek($week, $year, $locationId = null)
 {
     $zd = new Zend_Date();
     $event = new Event();
     $workshop = new Workshop();
     if ($week == 1) {
         $calData['prevWeekNum'] = 52;
         $calData['prevYear'] = $year - 1;
         $calData['nextWeekNum'] = 2;
         $calData['nextYear'] = $year;
     } else {
         if ($week == 52) {
             $calData['prevWeekNum'] = 51;
             $calData['prevYear'] = $year;
             $calData['nextWeekNum'] = 1;
             $calData['nextYear'] = $year + 1;
         } else {
             $calData['prevWeekNum'] = $week - 1;
             $calData['prevYear'] = $year;
             $calData['nextWeekNum'] = $week + 1;
             $calData['nextYear'] = $year;
         }
     }
     // go back to the current week
     $zd->setYear($year);
     $zd->setWeek($week);
     // set the weekday to sunday for the display purposes
     $zd->setWeekday("sunday");
     $month = $zd->get(Zend_Date::MONTH_SHORT);
     for ($x = 0; $x < 7; $x++) {
         $tmp = array();
         $tmp['startDay'] = $zd->get(Zend_Date::WEEKDAY_DIGIT);
         $tmp['month'] = $zd->get(Zend_Date::MONTH_SHORT);
         $tmp['day'] = $zd->get(Zend_Date::DAY_SHORT);
         $tmp['monthName'] = $zd->get(Zend_Date::MONTH_NAME);
         $tmp['monthDays'] = $zd->get(Zend_Date::MONTH_DAYS);
         $tmp['year'] = $zd->get(Zend_Date::YEAR);
         $tmp['weekNum'] = $zd->get(Zend_Date::WEEK);
         $tmp['date'] = $zd->getTimestamp();
         $calData[$x] = $tmp;
         $where = $event->getAdapter()->quoteInto('date = ?', $tmp['year'] . "-" . $tmp['month'] . "-" . $tmp['day']);
         $where .= " AND ";
         $where .= $event->getAdapter()->quoteInto('status = ?', 'open');
         if (!is_null($locationId)) {
             $where .= " AND ";
             $where .= $event->getAdapter()->quoteInto('locationId = ?', $locationId);
         }
         $calData[$x]['events'] = $event->fetchAll($where, 'startTime')->toArray();
         for ($y = 0; $y < count($calData[$x]['events']); $y++) {
             if (isset($calData[$x]['events'][$y]['workshopId'])) {
                 $tmpStart = strtotime($calData[$x]['events'][$y]['startTime']);
                 $tmpEnd = strtotime($calData[$x]['events'][$y]['endTime']);
                 $calData[$x]['events'][$y]['numMinutes'] = ($tmpEnd - $tmpStart) / 60;
                 $workshopId = $calData[$x]['events'][$y]['workshopId'];
                 $calData[$x]['events'][$y]['workshop'] = $workshop->find($workshopId)->toArray();
             }
         }
         $zd->addDay(1);
     }
     $calData['weekNum'] = $zd->get(Zend_Date::WEEK);
     $calData['year'] = $year;
     return $calData;
 }
 public function getIndex()
 {
     $workshops = Workshop::all();
     return View::make('admin.workshop.index', compact('workshops'));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Workshop::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $event = new Event();
     $events = $event->getEvents(null, null, null, time(), null, 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendees = new Event_Attendee();
     $lastRunDt = new Zend_Date($this->_lastRunDt);
     $currentDt = new Zend_Date();
     foreach ($events as $e) {
         $startDt = strtotime($e->date . ' ' . $e->startTime);
         $endDt = strtotime($e->date . ' ' . $e->endTime);
         $firstDt = new Zend_Date($startDt);
         $firstDt->subHour($config->user->numHoursFirstReminder->val);
         $finalDt = new Zend_Date($startDt);
         $finalDt->subHour($config->user->numHoursFinalReminder->val);
         $notification = null;
         if ($firstDt->getTimestamp() > $lastRunDt->getTimestamp() && $firstDt->getTimestamp() < $currentDt->getTimestamp()) {
             $notification = 'first';
         }
         if ($finalDt->getTimestamp() > $lastRunDt->getTimestamp() && $finalDt->getTimestamp() < $currentDt->getTimestamp()) {
             $notification = 'final';
         }
         if (!is_null($notification)) {
             $thisLocation = $location->find($e->locationId);
             if (is_null($thisLocation)) {
                 throw new Ot_Exception_Data('msg-error-noLocation');
             }
             $thisWorkshop = $workshop->find($e->workshopId);
             if (is_null($thisWorkshop)) {
                 throw new Ot_Exception_Data('msg-error-noWorkshop');
             }
             $instructors = $instructor->getInstructorsForEvent($e->eventId);
             $instructorNames = array();
             $instructorEmails = array();
             foreach ($instructors as $i) {
                 $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                 $instructorEmails[] = $i['emailAddress'];
             }
             $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
             $attending = $attendees->getAttendeesForEvent($e->eventId, 'attending');
             foreach ($attending as $a) {
                 $trigger = new Ot_Trigger();
                 $trigger->setVariables($data);
                 $trigger->accountId = $a['accountId'];
                 $trigger->studentEmail = $a['emailAddress'];
                 $trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
                 if ($notification == 'final') {
                     $trigger->dispatch('Event_Attendee_Final_Reminder');
                 } else {
                     $trigger->dispatch('Event_Attendee_First_Reminder');
                 }
             }
             $trigger = new Ot_Trigger();
             $trigger->setVariables($data);
             if ($notification == 'final') {
                 $trigger->dispatch('Event_Instructor_Final_Reminder');
             } else {
                 $trigger->dispatch('Event_Instructor_First_Reminder');
             }
         }
     }
 }
Exemple #22
0
});
Route::get('who-we-are', function () {
    return View::make('pages.who-we-are');
});
Route::get('history', function () {
    return View::make('pages.history');
});
//MAP
Route::get('map', 'HomeController@workshops');
// WORKSHOPS
Route::get('workshops/upcoming', function () {
    $workshops = Workshop::all();
    return View::make('workshops.upcoming', compact('workshops'));
});
Route::get('workshops/past', function () {
    $workshops = Workshop::all();
    return View::make('workshops.past', compact('workshops'));
});
// BLOG
Route::get('blog/news', function () {
    return View::make('blog.news');
});
Route::get('blog/testimonials', function () {
    return View::make('blog.testimonials');
});
Route::get('blog/stories', function () {
    return View::make('blog.stories');
});
// COLLABORATORS
Route::get('collaborators', function () {
    return View::make('collaborators.index');
Exemple #23
0
 public function workshops()
 {
     $workshops = Workshop::all();
     return View::make('map.index', compact('workshops'));
 }
Exemple #24
0
 public function deleterecursiveAction()
 {
     //delete workshop files
     //delete workshop -> triggers delete ce
     //delete ws info -> DB on delete cascade
     //delete ce
     //delete imageset attributes -> DB on delete cascade
     //delete ce has image -> DB on delete cascade
     //delete ce has attribute desc. -> DB on delete cascade
     //delete participants -> DB on delete cascade
     //delete annotations -> DB on delete cascade
     //delete dots -> DB on delete cascade
     $request = $this->getRequest();
     $workId = intval($this->getRequest()->getParam(Workshop::COL_ID));
     if (AuthQuery::getUserRole() == 'admin') {
         $request = $this->getRequest();
         $workId = intval($this->getRequest()->getParam(Workshop::COL_ID));
         $workshop = new Workshop();
         $rowset = $workshop->find($workId);
         if (count($rowset) == 1) {
             $table = new WorkshopInfo();
             //$tableAdapter = $table->getAdapter();
             $select = $table->select();
             //$select->from(WorkshopInfo::TABLE_NAME);
             $select->where(WorkshopInfo::COL_WORKSHOP_ID . ' = ?', $workId, 'int');
             echo $select;
             $rowset = $table->fetchAll($select);
             if (count($rowset) >= 1) {
                 $rowsetArray = $rowset->toArray();
                 $RELATIVE_WORKSHOP_FILES_PATH = 'infoFiles';
                 //without pre- and post-slash!
                 foreach ($rowsetArray as $row) {
                     try {
                         $filename = $row[WorkshopInfo::COL_FILE];
                         if ($filename != NULL) {
                             $myFile = $RELATIVE_WORKSHOP_FILES_PATH . '/' . $filename;
                             $fh = fopen($myFile, 'w');
                             fclose($fh);
                             unlink($myFile);
                         }
                     } catch (Exception $e) {
                         throw new Zend_Exception('Error: can not open file');
                     }
                 }
             }
             //note: delete of workshop_info is executed from db
             $workshop->delete($workshop->getAdapter()->quoteInto(Workshop::COL_ID . ' = ?', $workId));
         }
     }
     $redirect = new Zend_Controller_Action_Helper_Redirector();
     $redirect->setGoto('myws', 'search', 'workshop');
 }
 /**
  * Displays the results of an evaluation as long as the user requesting the
  * page is an instructor of the event.
  *
  */
 public function evaluationResultsAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $location = new Location();
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     $instructor = new Event_Instructor();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $instructorList = array();
     foreach ($instructors as $i) {
         $instructorList[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $instructorList;
     $this->_checkValidViewer($instructors);
     if ($thisEvent['evaluationType'] == 'custom') {
         // get the evaluationId from the eventId
         $evaluation = new Evaluation();
         $where = $evaluation->getAdapter()->quoteInto('eventId = ?', $thisEvent->eventId);
         $evaluations = $evaluation->fetchAll($where);
         if ($evaluations->count() == 0) {
             $this->view->noEvaluationsYet = true;
         }
         $this->view->totalEvaluations = $evaluations->count();
         $ca = new Ot_Custom();
         $questions = $ca->getAttributesForObject('evaluations');
         foreach ($questions as &$q) {
             $q['options'] = $ca->convertOptionsToArray($q['options']);
             $answers = array();
             foreach ($evaluations as $e) {
                 $tmpAnswers = $ca->getData($q['objectId'], $e->evaluationId);
                 $tmp = array();
                 foreach ($tmpAnswers as $ta) {
                     $tmp[$ta['attribute']['attributeId']] = $ta['value'];
                 }
                 $answers[] = $tmp;
             }
             if ($q['type'] == 'ranking' || $q['type'] == 'select' || $q['type'] == 'radio') {
                 foreach ($q['options'] as $value) {
                     $answerCount = 0;
                     foreach ($answers as $a) {
                         if ($a[$q['attributeId']] == $value) {
                             $answerCount++;
                         }
                     }
                     $q['results'][] = array('answerLabel' => $value, 'answerCount' => $answerCount);
                 }
             } else {
                 foreach ($answers as $a) {
                     $q['results'][] = $a[$q['attributeId']];
                 }
             }
         }
         $this->view->evaluationResults = $questions;
     } elseif ($thisEvent['evaluationType'] == 'google') {
         $evaluationKeys = new Evaluation_Key();
         $keys = $evaluationKeys->find($get->eventId);
         if (is_null($keys)) {
             throw new Ot_Exception_Data('msg-error-noFormKey');
         }
         $this->view->keys = $keys->toArray();
     }
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jquery.gchart.min.js');
 }
 /**
  * Handles the evaluation for an event.  Shows the user the evaluation and
  * saves the data from the evaluation.
  *
  */
 public function indexAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $eu = new Evaluation_User();
     $evaluation = new Evaluation();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $thisAccount = Zend_Auth::getInstance()->getIdentity();
     $status = $event->getStatusOfUserForEvent($thisAccount->accountId, $thisEvent->eventId);
     if ($status == "instructor") {
         throw new Ot_Exception_Access('msg-error-cannotEval');
     }
     if ($status != "attending") {
         throw new Ot_Exception_Access('msg-error-notAttended');
     }
     $config = Zend_Registry::get('config');
     $endDt = strtotime($thisEvent->date . " " . $thisEvent->endTime);
     if (time() > $endDt + $config->user->numHoursEvaluationAvailability->val * 3600) {
         throw new Ot_Exception_Access('msg-error-evalEnded');
     }
     if ($eu->hasCompleted($thisAccount->accountId, $thisEvent->eventId)) {
         throw new Ot_Exception_Access('msg-error-alreadyEval');
     }
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $instructor = new Event_Instructor();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $inst = array();
     foreach ($instructors as $i) {
         $inst[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $inst;
     // lookup the location of the event
     $location = new Location();
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     if ($thisEvent->evaluationType == 'custom') {
         $form = $evaluation->form();
         $this->view->form = $form;
     }
     if ($this->_request->isPost()) {
         if ($thisEvent->evaluationType == 'custom') {
             if ($form->isValid($_POST)) {
                 $custom = new Ot_Custom();
                 $attributes = $custom->getAttributesForObject('evaluations');
                 $data = array();
                 foreach ($attributes as $a) {
                     $data[$a['attributeId']] = is_null($form->getValue('custom_' . $a['attributeId'])) ? '' : $form->getValue('custom_' . $a['attributeId']);
                 }
                 // custom attributes is the custom array that will be save by the CustomAttributes model
                 $evaluation->saveEvaluation($thisEvent->eventId, $thisAccount->accountId, $data);
                 $this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
                 $this->_redirect('/');
             }
         } elseif ($thisEvent->evaluationType == 'google' && isset($_POST['googleSubmit'])) {
             $eu = new Evaluation_User();
             $dba = $eu->getAdapter();
             $dba->beginTransaction();
             $data = array('eventId' => $get->eventId, 'accountId' => $thisAccount->accountId);
             try {
                 $eu->insert($data);
             } catch (Exception $e) {
                 $dba->rollBack();
                 throw $e;
             }
             $dba->commit();
             $this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
             $this->_redirect('/');
         }
     }
     if ($thisEvent->evaluationType == 'google') {
         $evaluationKeys = new Evaluation_Key();
         $keys = $evaluationKeys->find($get->eventId);
         if (is_null($keys)) {
             throw new Ot_Exception_Data('msg-error-noFormKey');
         }
         $this->view->keys = $keys->toArray();
     }
     $this->_helper->pageTitle('workshop-evaluate-index:title');
 }
/* @var $this ProfileController */
?>

<div class="row-fluid">

    <div class="span-12">

        <div class="snippet-header">
            <h1><?php 
echo Yii::t('view', 'workshop.latest');
?>
</h1>
        </div>

        <?php 
$this->widget('bootstrap.widgets.TbExtendedGridView', array('dataProvider' => Workshop::getLatestWorkshopsSnippet(Yii::app()->params['defaultLatestWorkshopsToGet'], Yii::app()->user->getId()), 'selectableCells' => true, 'columns' => array(array('name' => 'workshop_cat_name', 'header' => 'Category'), array('name' => 'title', 'header' => 'Title'), array('name' => 'city', 'header' => 'Location'), array('header' => 'Date', 'type' => 'raw', 'value' => '$data["start_date"] . "<br>" . $data["end_date"]'), array('header' => 'Time', 'type' => 'raw', 'value' => '$data["start_time"] . "<br>" . $data["end_time"]'), array('header' => 'Register', 'type' => 'raw', 'value' => 'generateWorkshopBtn($data["id"], $data["registered"])'), array('value' => 'Yii::app()->getController()->createAbsoluteUrl("/workshop/workshop/view", array("id" => $data["id"]))', 'headerHtmlOptions' => array('style' => 'display: none;'), 'htmlOptions' => array('class' => 'link', 'style' => 'display: none;'))), 'rowCssClassExpression' => '"link-row"', 'selectableRows' => 1, 'template' => "{items}", 'emptyText' => "There are currently no Workshops", 'type' => 'bordered', 'htmlOptions' => array('class' => 'snippetWorkshopGrid')));
$btn = $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('view', 'workshop.more'), 'type' => 'primary', 'url' => array('/workshop/workshop/index'), 'size' => 'large', 'icon' => 'wrench'), true);
echo CHtml::tag('div', array('class' => 'snippet-more-area'), $btn);
?>

    </div>

</div>

<?php 
Yii::app()->clientScript->registerScript('snippertWorkshop', <<<EOD
\t\$(document).ready(function (){

       \$('.snippetWorkshopGrid tbody tr td').not(':has(a)').click(function(){
         var link = \$(this).parent('tr').children("td.link").html();
           if(link!=null)
 public function deleteLinkAction()
 {
     if ($this->_request->isXmlHttpRequest()) {
         $this->view->layout()->disableLayout();
     } else {
         $this->_helper->pageTitle('workshop-index-deleteLink:title');
     }
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->workshopLinkId)) {
         throw new Ot_Exception_Input('msg-error-workshopLinkIdNotSet');
     }
     $workshop = new Workshop();
     $link = new Workshop_Link();
     $thisLink = $link->find($get->workshopLinkId);
     if (is_null($thisLink)) {
         throw new Ot_Exception_Data('msg-error-noLink');
     }
     $thisWorkshop = $workshop->find($thisLink->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $we = new Workshop_Editor();
     if (!$this->_helper->hasAccess('edit-all-workshops') && !$we->isEditor($thisWorkshop->workshopId, Zend_Auth::getInstance()->getIdentity()->accountId)) {
         throw new Ot_Exception_Access('msg-error-noAccess');
     }
     $form = Ot_Form_Template::delete('deleteLink');
     $form->setAction($this->view->baseUrl() . '/workshop/index/delete-link/?workshopLinkId=' . $thisLink->workshopLinkId);
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $link->delete($link->getAdapter()->quoteInto('workshopLinkId = ?', $thisLink->workshopLinkId));
         $logOptions = array('attributeName' => 'workshopId', 'attributeId' => $thisWorkshop->workshopId);
         $this->_helper->log(Zend_Log::INFO, 'Link was deleted', $logOptions);
         $this->_helper->flashMessenger->addMessage('msg-info-linkDeleted');
         $this->_helper->redirector->gotoUrl('/workshop/index/details/?workshopId=' . $thisWorkshop->workshopId);
     }
     $this->view->form = $form;
 }
<?php

setcookie('csrf-workshop', md5(uniqid()), 0, '/');
$url = explode('/', $q);
$workshopId = $url[1];
require_once 'php/Workshop.php';
$workshop = Workshop::getData($workshopId);
if ($workshop) {
    $file = 'workshop-template';
    $slots = Workshop::getSlots($workshopId);
    $map = Workshop::generateRequestAssistanceMap($workshop->room);
} else {
    $file = '404';
}
 /**
  * Allows a user to cancel an event 
  * 
  */
 public function cancelEventAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $workshop = new Workshop();
     $event = new Event();
     $location = new Location();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $i = new Event_Instructor();
     $where = $i->getAdapter()->quoteInto('eventId = ?', $get->eventId);
     $results = $i->fetchAll($where);
     $currentInstructors = array();
     foreach ($results as $r) {
         $currentInstructors[] = $r->accountId;
     }
     if (!$this->_helper->hasAccess('view-all-instructor-pages') && !in_array(Zend_Auth::getInstance()->getIdentity()->accountId, $currentInstructors)) {
         throw new Ot_Exception_Access('msg-error-noWorkshopAccess');
     }
     $thisEvent = $thisEvent->toArray();
     $thisEvent['startTime'] = strftime('%l:%M %p', strtotime($thisEvent['startTime']));
     $thisEvent['endTime'] = strftime('%l:%M %p', strtotime($thisEvent['endTime']));
     $thisEvent['location'] = $location->find($thisEvent['locationId'])->toArray();
     $thisEvent['workshop'] = $workshop->find($thisEvent['workshopId'])->toArray();
     $this->view->event = $thisEvent;
     $form = Ot_Form_Template::delete('eventDelete', 'workshop-schedule-cancelEvent:cancel');
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $dba = $event->getAdapter();
         $dba->beginTransaction();
         $where = $dba->quoteInto('eventId = ?', $get->eventId);
         $data = array('status' => 'canceled');
         try {
             $result = $event->update($data, $where);
         } catch (Exception $e) {
             $dba->rollback();
             throw $e;
         }
         $attendee = new Event_Attendee();
         try {
             $attendee->update($data, $where);
         } catch (Exception $e) {
             $dba->rollback();
             throw $e;
         }
         $dba->commit();
         $this->_helper->flashMessenger->addMessage('msg-info-eventCanceled');
         $date = explode('-', $thisEvent['date']);
         $this->_helper->redirector->gotoUrl('/workshop/schedule?startYear=' . $date[0] . '&startMonth=' . (int) $date[1]);
     }
     $this->_helper->pageTitle('workshop-schedule-cancelEvent:title');
     $this->view->form = $form;
 }