Example #1
0
 public function render()
 {
     //japplication
     $app = JFactory::getApplication();
     $id = $app->input->get('id') ? $app->input->get('id') : null;
     $layout = $this->getLayout();
     //get model
     $model = new CompanyModel();
     //layout
     switch ($layout) {
         case "add":
         case "edit":
             $this->company = $model->getCompany();
             $edit_custom_fields_view = ViewHelper::getView('custom', 'edit', 'html');
             $edit_custom_fields_view->type = "company";
             $edit_custom_fields_view->item = $this->company;
             $this->edit_custom_fields_view = $edit_custom_fields_view;
             break;
         case "entry":
             $this->company = $model->getCompany();
             $this->k = 0;
             break;
         case "list":
             $this->companies = $model->getCompanies($id);
             $this->total = $model->getTotal();
             $this->pagination = $model->getPagination();
             $this->state = $model->getState();
             break;
     }
     //display view
     echo parent::render();
 }
Example #2
0
 public function render($tpl = null)
 {
     //get model and retrieve info
     $model = new EventModel();
     if (TemplateHelper::isMobile()) {
         $model->set('current_events', true);
     }
     $events = $model->getEvents();
     $eventDock = ViewHelper::getView('events', 'dashboard_event_dock', 'phtml', array('events' => $events));
     $dealModel = new DealModel();
     $dealModel->set('_view', 'dashboard');
     $dealModel->set('recent', true);
     $dealModel->set('archived', 0);
     $recentDeals = $dealModel->getDeals();
     $doc = JFactory::getDocument();
     //get data for sales graphs
     $model = new GraphsModel();
     $graph_data = $model->getGraphData();
     $activityHelper = new ActivityHelper();
     $activity = $activityHelper->getActivity();
     //assign results to view
     $this->eventDock = $eventDock;
     $this->graph_data = $graph_data;
     $this->recentDeals = $recentDeals;
     $this->activity = $activity;
     $json = TRUE;
     $peopleModel = new PeopleModel();
     if (TemplateHelper::isMobile()) {
         $dealModel->set('recent', false);
         $totalDeals = $dealModel->getTotal();
         $peopleModel->set('type', 'leads');
         $totalLeads = $peopleModel->getTotal();
         $peopleModel->set('type', 'not_leads');
         $totalContacts = $peopleModel->getTotal();
         $companyModel = new CompanyModel();
         $totalCompanies = $companyModel->getTotal();
         $user = UsersHelper::getLoggedInUser();
         $this->first_name = $user->first_name;
         $this->numEvents = count($events);
         $this->numDeals = $totalDeals;
         $this->numLeads = $totalLeads;
         $this->numContacts = $totalContacts;
         $this->numCompanies = $totalCompanies;
     }
     $peopleNames = $peopleModel->getPeopleNames($json);
     $doc->addScriptDeclaration("var people_names=" . $peopleNames . ";");
     $dealModel = new DealModel();
     $dealNames = $dealModel->getDealNames($json);
     $doc->addScriptDeclaration("var deal_names=" . $dealNames . ";");
     /** get latest activities **/
     $this->latest_activities = ViewHelper::getView('dashboard', 'latest_activities', 'phtml');
     $this->latest_activities->activity = $activity;
     $activityHelper = new ActivityHelper();
     $activity = $activityHelper->getActivity();
     //display
     return parent::render();
 }