Пример #1
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //site document
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     //gather information for view
     $model = new CategoriesModel();
     $layout = $this->getLayout();
     $model->set("_layout", $layout);
     if ($layout && $layout == 'edit') {
         ToolbarHelper::cancel('cancel');
         ToolbarHelper::save('save');
         $this->category = $model->getCategory();
     } else {
         //buttons
         ToolbarHelper::addNew('edit');
         ToolbarHelper::editList('edit');
         ToolbarHelper::deleteList(TextHelper::_('COBALT_CONFIRMATION'), 'remove');
         //view references
         $categories = $model->getCategories();
         $this->categories = $categories;
         // Initialise state variables.
         $state = $model->getState();
         $this->state = $state;
         $this->listOrder = $state->get('Categories.filter_order');
         $this->listDirn = $state->get('Categories.filter_order_Dir');
     }
     //display
     return parent::render();
 }
Пример #2
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //app
     $app = \Cobalt\Container::fetch('app');
     if ($app->input->get('layout') == 'sample') {
         $this->_displaySample($tpl);
         return;
     }
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //javascripts
     $doc = $app->getDocument();
     $doc->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     $doc->addScript(JURI::base() . "/src/Cobalt/media/js/document_manager.js");
     //import data
     $import_post = FALSE;
     if (count($_FILES) > 0) {
         $import_post = TRUE;
         $import_data = array();
         $import_type = $app->input->get('import_type');
         $model = new ImportModel();
         foreach ($_FILES as $file) {
             $data = $model->readCSVFile($file['tmp_name']);
             $import_data = array_merge($import_data, $data);
         }
         if (count($import_data) > 500) {
             switch ($app->input->get('import_type')) {
                 case "company":
                     $import_model = "company";
                     break;
                 case "people":
                     $import_model = "people";
                     break;
                 case "deals":
                     $import_model = "deal";
                     break;
             }
             if ($model->importCSVData($import_data, $import_model)) {
                 $success = "SUCCESSFULLY";
             } else {
                 $success = "UNSUCCESSFULLY";
             }
             $view = "import";
             $msg = TextHelper::_('COBALT_' . $success . '_IMPORTED_ITEMS');
             $app->redirect('index.php?view=' . $view, $msg);
         }
         $this->headers = $import_data['headers'];
         unset($import_data['headers']);
         $this->import_data = $import_data;
         $this->import_type = $import_type;
         $doc->addScriptDeclaration('import_length=' . count($import_data) . ';');
         $doc->addScriptDeclaration("show_tab='import_review';");
     }
     $this->import_post = $import_post;
     //display
     return parent::render();
 }
Пример #3
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     $app = \Cobalt\Container::fetch('app');
     $document = $app->getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     $configModel = new ConfigModel();
     /** Component version **/
     $installedVersion = ConfigHelper::getVersion();
     $latestVersion = VersionHelper::getLatestVersion();
     $updateUrl = "http://www.cobaltcrm.org/support/login";
     $updatesFeed = $configModel->getUpdatesRSS();
     /** Launch completion **/
     $config = $configModel->getConfig();
     $this->launch_default = $config->launch_default;
     $percentage = $menu['percentage'];
     $this->setup_percent = $percentage;
     /** php version check **/
     $this->php_version = (double) phpversion();
     $this->php_version_check = $this->php_version >= 5.3 ? TRUE : FALSE;
     /** View Ref **/
     $this->installedVersion = $installedVersion;
     $this->latestVersion = $latestVersion;
     $this->updateUrl = $updateUrl;
     $this->updatesFeed = $updatesFeed;
     //display
     return parent::render();
 }
Пример #4
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //menu Links
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //add javascript
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/branding_manager.js');
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     //view refs
     $model = new BrandingModel();
     $themes = $model->getThemes();
     //toolbar buttons
     ToolbarHelper::save('save', 'Save');
     //toolbar items
     $list = array('dashboard', 'deals', 'people', 'companies', 'calendar', 'documents', 'goals', 'reports');
     $this->toolbar_list = $list;
     $this->themes = $themes;
     $this->site_logo = StylesHelper::getSiteLogo();
     $this->site_name = StylesHelper::getSiteName();
     //assign default theme
     foreach ($this->themes as $key => $row) {
         if ($row['assigned']) {
             $document->addScriptDeclaration("var assigned_theme=" . $row['id'] . ";");
         }
     }
     //display
     return parent::render();
 }
Пример #5
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //display toolbar
     $this->toolbar = new Toolbar();
     $this->toolbar->save();
     //document
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     /* Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //get model
     $model = new ConfigModel();
     $layout = $this->getLayout();
     $model->set("_layout", $layout);
     //get config
     $config = $model->getConfig();
     //generate timezones
     $list = timezone_identifiers_list();
     $timezones = array();
     foreach ($list as $zone) {
         $timezones[$zone] = $zone;
     }
     //view references
     $this->imap_found = function_exists('imap_open') ? TRUE : FALSE;
     $this->config = $config;
     $this->timezones = $timezones;
     $this->time_formats = DateHelper::getTimeFormats();
     $this->languages = ConfigHelper::getLanguages();
     $this->language = ConfigHelper::getLanguage();
     //display
     return parent::render();
 }
Пример #6
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //display
     return parent::render();
 }
Пример #7
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     /** Menu Links **/
     $side_menu = MenuHelper::getMenuModules();
     $this->side_menu = $side_menu;
     //display
     return parent::render();
 }
Пример #8
0
 public function render()
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //load model
     $layout = $this->getLayout();
     $model = new FormWizardModel();
     $model->set("_layout", $layout);
     //document
     $document = JFactory::getDocument();
     // Create the toolbar object
     $this->toolbar = new Toolbar();
     //add toolbar buttons to manage users
     if ($layout == 'default') {
         //buttons
         $this->toolbar->addNew();
         $this->toolbar->addDeleteRow();
         ToolbarHelper::addNew('edit');
         ToolbarHelper::editList('edit');
         ToolbarHelper::deleteList(TextHelper::_('COBALT_CONFIRMATION'), 'remove');
         // Initialise variables.
         $this->state = $model->getState();
         $this->forms = $model->getForms();
         $this->listOrder = $this->state->get('Formwizard.filter_order');
         $this->listDirn = $this->state->get('Formwizard.filter_order_Dir');
     } elseif ($layout == 'edit') {
         //buttons
         $this->toolbar->save();
         $this->toolbar->cancel();
         //form
         $form_id = $model->getTempFormId();
         $this->form_id = $form_id;
         $this->form = $model->getForm();
         //form types
         $this->form_types = DropdownHelper::getFormTypes($this->form['type']);
         $fields = array('lead' => DropdownHelper::getFormFields('people'), 'contact' => DropdownHelper::getFormFields('people'), 'deal' => DropdownHelper::getFormFields('deal'), 'company' => DropdownHelper::getFormFields('company'));
         $this->fields = $fields;
         $document->addScriptDeclaration('var fields=' . json_encode($fields));
         //get joomla users to add
         $model = new UsersModel();
         $user_list = $model->getUsers();
         $document->addScriptDeclaration('var user_list=' . json_encode($user_list) . ';');
     }
     //javascripts
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/jquery.base64.js');
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/formwizard.js');
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //display
     return parent::render();
 }
Пример #9
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //application
     $app = \Cobalt\Container::fetch('app');
     //display title
     $document = JFactory::getDocument();
     //load model
     $layout = $this->getLayout();
     $model = new UsersModel();
     $model->set("_layout", $layout);
     //add toolbar buttons to manage users
     if ($layout == 'default') {
         $this->toolbar = new Toolbar();
         $this->toolbar->addNew();
         $this->toolbar->addDeleteRow();
         //get users
         $users = $model->getUsers();
         // Initialise variables.
         $this->state = $model->getState();
         //assign refs
         $this->users = $users;
         $this->listOrder = $this->state->get('Users.filter_order');
         $this->listDirn = $this->state->get('Users.filter_order_Dir');
     } elseif ($this->getLayout() == 'edit') {
         $model = new UserModel();
         $model->set("_layout", $layout);
         $this->toolbar = new Toolbar();
         $this->toolbar->save();
         $this->toolbar->cancel();
         //get id
         $id = $app->input->getInt('id', null);
         //plugins
         //$app->triggerEvent('onBeforeCRMUserEdit', array(&$id));
         //get user
         $this->user = $model->getUser($id);
         //view data
         $roles = DropdownHelper::getMemberRoles();
         $teamId = UsersHelper::getTeamId($id);
         $teams = UsersHelper::getTeams($teamId);
         $managers = DropdownHelper::getManagers($id);
         $this->member_roles = $roles;
         $this->teams = $teams;
         $this->managers = $managers;
     }
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //display
     return parent::render();
 }
Пример #10
0
 public function render()
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     // Create toolbar
     $this->toolbar = new Toolbar();
     //document
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     $layout = $this->getLayout();
     //gather information for view
     $model = new StatusesModel();
     $model->set("_layout", $layout);
     $this->pagination = $model->getPagination();
     if ($layout && $layout == 'edit') {
         //toolbar buttons
         $this->toolbar->cancel();
         $this->toolbar->save();
         //javascripts
         $document->addScript(JURI::base() . 'src/Cobalt/media/js/bootstrap-colorpicker.js');
         //stylesheets
         $document->addStylesheet(JURI::base() . 'src/Cobalt/media/css/bootstrap-colorpicker.css');
         //get status
         $this->status = $model->getStatus();
         //script declarations
         if ($this->status['color'] != null) {
             $document->addScriptDeclaration('var status_color = "' . $this->status['color'] . '";');
         } else {
             $document->addScriptDeclaration('var status_color = "ff0000";');
         }
     } else {
         //buttons
         $this->toolbar->addNew();
         ToolbarHelper::editList('edit');
         $this->toolbar->addDeleteRow();
         //statuses
         $statuses = $model->getStatuses();
         $this->statuses = $statuses;
         // Initialise state variables.
         $state = $model->getState();
         $this->state = $state;
         $this->listOrder = $this->state->get('Statuses.filter_order');
         $this->listDirn = $this->state->get('Statuses.filter_order_Dir');
         $this->saveOrder = $this->listOrder == 'c.ordering';
     }
     //display
     return parent::render();
 }
Пример #11
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //Add styles for iframe popup
     echo "<link href='" . JURI::base() . "src/Cobalt/media/css/style.css' type='text/css' rel='stylesheet' />";
     echo "<link href='" . JURI::base() . "src/Cobalt/media/css/bootstrap.min.css' type='text/css' rel='stylesheet' />";
     //import document
     if (is_array($_FILES) && count($_FILES) > 0) {
         $model = new DocumentsModel();
         $model->upload();
     }
     //display
     return parent::render();
 }
Пример #12
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //document
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/custom_manager.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //model
     $model = new DealCustomModel();
     //gather information for view
     $layout = $this->getLayout();
     $model->set("_layout", $layout);
     $this->pagination = $model->getPagination();
     if ($layout && $layout == 'edit') {
         //toolbar
         ToolbarHelper::cancel('cancel');
         ToolbarHelper::save('save');
         //assign view info
         $this->custom_types = DropdownHelper::getCustomTypes('deal');
         $this->custom = $model->getItem();
         if ($this->custom['type'] != null) {
             $document->addScriptDeclaration('var type = "' . $this->custom['type'] . '";');
         }
     } else {
         //buttons
         ToolbarHelper::addNew('edit');
         ToolbarHelper::editList('edit');
         ToolbarHelper::deleteList(TextHelper::_('COBALT_CONFIRMATION'), 'delete');
         //assign view info
         $custom = $model->getCustom();
         $this->custom_fields = $custom;
         // Initialise state variables.
         $state = $model->getState();
         $this->state = $state;
         $this->listOrder = $this->state->get('Dealcustom.filter_order');
         $this->listDirn = $this->state->get('Dealcustom.filter_order_Dir');
         $this->saveOrder = $this->listOrder == 'c.ordering';
     }
     //display
     return parent::render();
 }
Пример #13
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     // Create toolbar
     $this->toolbar = new Toolbar();
     //javascripts
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //gather information for view
     $model = new TemplatesModel();
     //get layout
     $layout = $this->getLayout();
     $model->set("_layout", $layout);
     //filter for layout type
     if ($layout == "edit") {
         //toolbar buttons
         $this->toolbar->cancel();
         $this->toolbar->save();
         //javascripts
         $document->addScript(JURI::base() . 'src/Cobalt/media/js/template_manager.js');
         //assign view data
         $this->template_types = DropdownHelper::getTemplateTypes();
         $this->template = $model->getTemplate();
     } else {
         //buttons
         $this->toolbar->addNew();
         ToolbarHelper::editList('edit');
         $this->toolbar->addDeleteRow();
         $templates = $model->getTemplates();
         $this->templates = $templates;
         // Initialise state variables.
         $state = $model->getState();
         $this->state = $state;
         $this->listOrder = $this->state->get('Templates.filter_order');
         $this->listDirn = $this->state->get('Templates.filter_order_Dir');
     }
     //display
     return parent::render();
 }
Пример #14
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     /** Menu Links **/
     $side_menu = MenuHelper::getMenuModules();
     $this->side_menu = $side_menu;
     // Create toolbar
     $this->toolbar = new Toolbar();
     $this->toolbar->save();
     $model = new MenuModel();
     $menu = $model->getMenu();
     $menu_template = $model->getMenuTemplate();
     $this->menu = $menu;
     $this->menu_template = $menu_template;
     //display
     return parent::render();
 }
Пример #15
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //document
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js');
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //gather information for view
     $model = new SourcesModel();
     $layout = $this->getLayout();
     $model->set("_layout", $layout);
     $this->pagination = $model->getPagination();
     if ($layout && $layout == 'edit') {
         //toolbar
         ToolbarHelper::cancel('cancel');
         ToolbarHelper::save('save');
         //information for view
         $this->source_types = DropdownHelper::getSources();
         $this->source = $model->getSource();
     } else {
         //buttons
         ToolbarHelper::addNew('edit');
         ToolbarHelper::editList('edit');
         ToolbarHelper::deleteList(TextHelper::_('COBALT_CONFIRMATION'), 'delete');
         //get sources
         $sources = $model->getSources();
         $this->sources = $sources;
         // Initialise state variables.
         $state = $model->getState();
         $this->state = $state;
         $this->listOrder = $this->state->get('Sources.filter_order');
         $this->listDirn = $this->state->get('Sources.filter_order_Dir');
         $this->saveOrder = $this->listOrder == 's.ordering';
     }
     //display
     return parent::render();
 }
Пример #16
0
 public function render()
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     return parent::render();
 }