public function render() { $app = JFactory::getApplication(); //grab model $model = new EventModel(); if ($this->getLayout() == "event_listings" || $this->getLayout() == "list") { $events = $model->getEvents(); $this->events = $events; } else { //null event $event = array(); $id = null; if ($app->input->get('parent_id') && !$app->input->get('id')) { $id = $app->input->get('parent_id'); } else { $id = $app->input->get('id'); } //grab event if ($id != null) { $event = $model->getEvent($id); } //pass reference $this->event = $event; } if ($app->input->get('association_id')) { $this->association_name = CobaltHelper::getAssociationName(); } //display echo parent::render(); }
public function buildWhere() { if ($this->deal_id) { $this->query->where("(cf.association_id = " . $this->deal_id . " OR d2.id = " . $this->deal_id . ")"); } if ($this->event_id) { $event_model = new Event(); $event = $event_model->getEvent($this->event_id); if (array_key_exists('association_type', $event) && $event['association_type'] != null) { switch ($event['association_type']) { case "person": $this->query->where("p.id=" . $event['association_id']); break; case "deal": $this->query->where("cf.association_id=" . $event['association_id']); $this->query->where("cf.association_type='deal'"); break; case "company": $this->query->where("p.company_id=" . $event['association_id']); break; } } else { return false; } } if ($this->company_id) { $this->query->where("p.company_id=" . $this->company_id); } //filter based on member access roles $user_id = UsersHelper::getUserId(); $member_role = UsersHelper::getRole(); $team_id = UsersHelper::getTeamId(); if ($member_role != 'exec') { if ($member_role == 'manager') { $this->query->where("u.team_id={$team_id}"); } else { $this->query->where("p.owner_id={$user_id}"); } } $this->query->where("p.published>0"); return true; }