Beispiel #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();
 }
Beispiel #2
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();
 }
Beispiel #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();
 }
Beispiel #4
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();
 }
Beispiel #5
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();
 }
Beispiel #6
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();
 }
Beispiel #7
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();
 }
Beispiel #8
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();
 }
Beispiel #9
0
 public static function getMenuModules()
 {
     $modules = array();
     $app = \Cobalt\Container::fetch('app');
     /** Side menu links **/
     $menu_links = MenuHelper::getMenuLinks();
     $menu = ViewHelper::getView('cobalt', 'menu', 'phtml');
     $menu->menu_links = $menu_links;
     $modules['menu'] = $menu;
     /** Quick Menu Links **/
     $quick_menu_links = MenuHelper::getQuickMenuLinks();
     $quick_menu = ViewHelper::getView('cobalt', 'quick_menu', 'phtml');
     $quick_menu->quick_menu_links = $quick_menu_links;
     $modules['quick_menu'] = $quick_menu;
     /** Determine help type on page **/
     $help_type_1 = $app->input->get('view') != '' || !is_null($app->input->get('view')) ? $app->input->get('view') : $app->input->get('controller');
     $help_type_2 = $app->input->get('layout') != '' || !is_null($app->input->get('layout')) ? $app->input->get('layout') : $app->input->get('task');
     $help_type_1 = $help_type_1 == "" || is_null($help_type_1) ? "" : $help_type_1;
     $help_type_2 = $help_type_2 == "" || is_null($help_type_2) ? "" : '_' . $help_type_2;
     $help_type = str_replace(".", "_", $help_type_1 . $help_type_2);
     $help_types = self::getHelpTypes();
     $show_help = ConfigHelper::getConfigValue('show_help');
     $launch_default = ConfigHelper::getConfigValue('launch_default');
     $step_completed = ConfigHelper::getConfigValue($help_type);
     $show_update_buttons = in_array($help_type, $help_types);
     /** Help Menu Links **/
     $help_menu_links = MenuHelper::getHelpMenuLinks();
     $help_menu = ViewHelper::getView('cobalt', 'help_menu', 'phtml');
     $help_menu->help_menu_links = $help_menu_links;
     $help_menu->help_type = $help_type;
     $help_menu->show_help = $show_help;
     $help_menu->launch_default = $launch_default;
     $help_menu->step_completed = $step_completed;
     $help_menu->show_update_buttons = $show_update_buttons;
     $modules['help_menu'] = $help_menu;
     $count = count($help_menu_links) - 1;
     $completed = 0;
     foreach ($help_menu_links as $link) {
         if ($link['completed_status'] == 1) {
             $completed++;
         }
     }
     $modules['percentage'] = number_format($completed / $count * 100, 0);
     return $modules;
 }
Beispiel #10
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();
 }
Beispiel #11
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();
 }
Beispiel #12
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();
 }
Beispiel #13
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();
 }
Beispiel #14
0
 public function _displaySample($tpl = null)
 {
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     $app = \Cobalt\Container::fetch('app');
     $doc = $app->getDocument();
     $doc->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     return parent::render();
 }