diff --git a/libraries/joomla/language/text.php b/libraries/joomla/language/text.php index 91a3fc8b..5c1f9bea 100644 --- a/libraries/joomla/language/text.php +++ b/libraries/joomla/language/text.php @@ -111,9 +111,9 @@ public static function alt($string, $alt, $jsSafe = false, $interpretBackSlashes * script is a boolean to indicate that the string will be push in the javascript language store. * * Examples: - * + * * will generate an alert message containing '1 plugin successfully disabled' - * it will generate a '1 plugin successfully disabled' string + * it will generate a '1 plugin successfully disabled' string * * @param string $string The format string. * @param integer $n The number of items diff --git a/src/Cobalt/Controller/Graph.php b/src/Cobalt/Controller/Graph.php index abf570e9..16babc60 100644 --- a/src/Cobalt/Controller/Graph.php +++ b/src/Cobalt/Controller/Graph.php @@ -22,11 +22,11 @@ public function execute() //get graph data from model $model = new GraphsModel; - $type = $this->getInput()->get('filter'); + $type = $this->getInput()->getCmd('filter'); if ($type == 'company') { $graph_data = $model->getGraphData('company'); } else { - $graph_data = $model->getGraphData($type,$this->getInput()->get('id')); + $graph_data = $model->getGraphData($type,$this->getInput()->getInt('id')); } //return data diff --git a/src/Cobalt/Controller/SaveCf.php b/src/Cobalt/Controller/SaveCf.php index 40b2a0cc..f3ba499c 100644 --- a/src/Cobalt/Controller/SaveCf.php +++ b/src/Cobalt/Controller/SaveCf.php @@ -13,6 +13,7 @@ use Cobalt\Helper\DateHelper; use Cobalt\Model\Deal as DealModel; use Cobalt\Model\People as PeopleModel; +use Cobalt\Helper\TextHelper; // no direct access defined( '_CEXEC' ) or die( 'Restricted access' ); @@ -79,7 +80,7 @@ public function execute() $model = new PeopleModel; $return = $model->getPerson($data['person_id']); $response->alert = new \stdClass; - $response->alert->message = \JText::_('DEAL_CONTACT_ADDED_SUCCESS'); + $response->alert->message = TextHelper::_('DEAL_CONTACT_ADDED_SUCCESS'); $response->alert->type = 'success'; $response->item = $return; $response->reload = 2000; @@ -96,7 +97,7 @@ public function execute() } } else { $response->alert = new \stdClass; - $response->alert->message = \JText::_('DEAL_CONTACT_ERROR_FAILURE_ADD_PERSON'); + $response->alert->message = TextHelper::_('DEAL_CONTACT_ERROR_FAILURE_ADD_PERSON'); $response->alert->type = 'error'; } diff --git a/src/Cobalt/Helper/LinkHelper.php b/src/Cobalt/Helper/LinkHelper.php new file mode 100644 index 00000000..3250e62f --- /dev/null +++ b/src/Cobalt/Helper/LinkHelper.php @@ -0,0 +1,199 @@ + 'dashboard' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function viewDocuments(array $params = array()) + { + $link = array( + 'view' => 'documents' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function viewAdminDocuments(array $params = array()) + { + $link = array( + 'view' => 'admindocuments' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function viewImport(array $params = array()) + { + $link = array( + 'view' => 'import' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function upload(array $params = array()) + { + $link = array( + 'task' => 'upload' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * Link to view deal + * + * @param $deal_id + * @return string + */ + public static function viewDeal($deal_id, array $params = array()) + { + $link = array( + 'view' => 'deal', + 'layout' => 'deal', + 'id' => intval($deal_id) + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function viewDeals(array $params = array()) + { + $link = array( + 'view' => 'deals' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * @param array $params + * @return string + */ + public static function viewReports(array $params = array()) + { + $link = array( + 'view' => 'reports' + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * Link to view person + * + * @param $person_id + * @return string + */ + public static function viewPerson($person_id, array $params = array()) + { + $link = array( + 'view' => 'people', + 'layout' => 'person', + 'id' => intval($person_id) + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * Link to view Company + * + * @param $copmany_id + * @return string + */ + public static function viewCompany($copmany_id, array $params = array()) + { + $link = array( + 'view' => 'companies', + 'layout' => 'company', + 'id' => intval($copmany_id) + ); + + $query = array_merge($link, $params); + + return self::create($query); + } + + /** + * Build Custom URL by array of keys and values + * + * @param array $query + * @return string + */ + public static function create(array $query) + { + return RouteHelper::_('index.php?'.http_build_query($query)); + } +} \ No newline at end of file diff --git a/src/Cobalt/Model/Commission.php b/src/Cobalt/Model/Commission.php index 81387cb2..816f5630 100644 --- a/src/Cobalt/Model/Commission.php +++ b/src/Cobalt/Model/Commission.php @@ -13,6 +13,7 @@ use Cobalt\Helper\UsersHelper; use Cobalt\Helper\DateHelper; use Cobalt\Helper\DealHelper; +use Cobalt\Helper\TextHelper; // no direct access defined( '_CEXEC' ) or die( 'Restricted access' ); @@ -58,9 +59,9 @@ public function getMonthlyCommission($access_type=null,$access_id=null) foreach ($members as $key=>$member) { foreach ($member as $date_key => $data) { if ( array_key_exists($date_key,$results) ) { - $results[$date_key]['y'] += $data['y']; + $results[$date_key] += $data; } else { - $results[$date_key]['y'] = $data['y']; + $results[$date_key] = $data; } } } @@ -84,7 +85,9 @@ public function getYearlyCommission($access_type=null,$access_id=null) //array to assign our data $members = array(); - $results = array(); + $data = new \stdClass; + $data->labels = array(); + $data->datasets = array(); //get team data if ($access_type == 'team') { @@ -105,17 +108,25 @@ public function getYearlyCommission($access_type=null,$access_id=null) } //combine data - foreach ($members as $key=>$member) { - foreach ($member as $date_key=>$data) { - if ( array_key_exists($date_key,$results) ) { - $results[$date_key]['y'] += $data['y']; - } else { - $results[$date_key]['y'] = $data['y']; + $results = array(); + foreach ($members as $member) { + foreach ($member->datasets[0]->data as $key => $value) { + if (!isset($results[$key])) { + $results[$key] = 0; } + $results[$key] += $value; } } - return $results; + $data->datasets[0] = new \stdClass; + $data->datasets[0]->data = $results; + $data->datasets[0]->label = ''; + $data->datasets[0]->fillColor = "rgba(151,187,205,0.5)"; + $data->datasets[0]->strokeColor = "rgba(151,187,205,0.8)"; + $data->datasets[0]->pointColor = "rgba(151,187,205,0.75)"; + $data->datasets[0]->pointStrokeColor = "rgba(151,187,205,1)"; + + return $data; } } @@ -136,11 +147,17 @@ public function getMonthlyCommissionData($id) //get stage id to filter deals by $won_stage_ids = DealHelper::getWonStages(); + $data = new \stdClass; + $data->labels = array(); + $data->datasets = array(); + //gen query $results = array(); foreach ($weeks as $week) { $start_date = $week['start_date']; $end_date = $week['end_date']; + $weekDate = new \DateTime($start_date); + $data->labels[] = TextHelper::_('COBALT_WEEK') . ' ' . $weekDate->format('W'); //flush query $query = $this->db->getQuery(true) @@ -160,10 +177,18 @@ public function getMonthlyCommissionData($id) //clean data for commission rate foreach ($results as $key => $result) { $commission_rate = UsersHelper::getCommissionRate($result['owner_id']); - $results[$key]['y'] = (int) $result['y']*($commission_rate/100); + $results[$key] = (int) $result['y']*($commission_rate/100); } - return $results; + $data->datasets[0] = new \stdClass; + $data->datasets[0]->data = $results; + $data->datasets[0]->label = ''; + $data->datasets[0]->fillColor = "rgba(151,187,205,0.5)"; + $data->datasets[0]->strokeColor = "rgba(151,187,205,0.8)"; + $data->datasets[0]->pointColor = "rgba(151,187,205,0.75)"; + $data->datasets[0]->pointStrokeColor = "rgba(151,187,205,1)"; + + return $data; } /** @@ -178,6 +203,10 @@ public function getYearlyCommissionData($id) $month_names = DateHelper::getMonthNames(); $months = DateHelper::getMonthDates(); + $data = new \stdClass; + $data->labels = array(); + $data->datasets = array(); + //get stage id to filter deals by $won_stage_ids = DealHelper::getWonStages(); @@ -186,6 +215,8 @@ public function getYearlyCommissionData($id) foreach ($months as $month) { $start_date = $month['date']; $end_date = DateHelper::formatDBDate(date('Y-m-d 00:00:00',strtotime("$start_date + 1 months"))); + $weekDate = new \DateTime($start_date); + $data->labels[] = TextHelper::_('COBALT_MONTH') . ' ' . $weekDate->format('m'); //flush the query $query = $this->db->getQuery(true) @@ -205,10 +236,18 @@ public function getYearlyCommissionData($id) //clean data for commission rate foreach ($results as $key=>$result) { $commission_rate = UsersHelper::getCommissionRate($result['owner_id']); - $results[$key]['y'] = (int) $result['y']*($commission_rate/100); + $results[$key] = (int) $result['y']*($commission_rate/100); } - return $results; + $data->datasets[0] = new \stdClass; + $data->datasets[0]->data = $results; + $data->datasets[0]->label = ''; + $data->datasets[0]->fillColor = "rgba(151,187,205,0.5)"; + $data->datasets[0]->strokeColor = "rgba(151,187,205,0.8)"; + $data->datasets[0]->pointColor = "rgba(151,187,205,0.75)"; + $data->datasets[0]->pointStrokeColor = "rgba(151,187,205,1)"; + + return $data; } } diff --git a/src/Cobalt/Model/Deal.php b/src/Cobalt/Model/Deal.php index f014fae7..4e209592 100644 --- a/src/Cobalt/Model/Deal.php +++ b/src/Cobalt/Model/Deal.php @@ -10,6 +10,7 @@ namespace Cobalt\Model; +use Cobalt\Helper\LinkHelper; use Joomla\Database\DatabaseDriver; use Joomla\Registry\Registry; use Joomla\Filter\OutputFilter; @@ -1526,10 +1527,10 @@ public function getDataTableFieldTemplate($column, $item) $template = ''; break; case 'name': - $template = ''.$item->name.''; + $template = ''.$item->name.''; break; case 'company_name': - $template = ''.$item->company_name.''; + $template = ''.$item->company_name.''; break; case 'amount': $template = ConfigHelper::getCurrency().$item->amount; @@ -1647,7 +1648,7 @@ public function getDataTableFieldTemplate($column, $item) $template .= ''; $template .= '
'; $template .= ' '.TextHelper::_('COBALT_PRIMARY_CONTACT').''; - $template .= ' '.$item->primary_contact_first_name.'
'; + $template .= ' '.$item->primary_contact_first_name.'
'; $template .= ' '.TextHelper::_('COBALT_NEXT_ACTION').'
'; $template .= '
'; break; diff --git a/src/Cobalt/Model/Document.php b/src/Cobalt/Model/Document.php index 34ea1779..4eafe4be 100644 --- a/src/Cobalt/Model/Document.php +++ b/src/Cobalt/Model/Document.php @@ -17,7 +17,6 @@ use Cobalt\Helper\DateHelper; use Cobalt\Helper\UsersHelper; use Cobalt\Helper\FileHelper; -use JUri; use Cobalt\Helper\RouteHelper; // no direct access diff --git a/src/Cobalt/Model/Documents.php b/src/Cobalt/Model/Documents.php index ca3cf377..bf996a7f 100644 --- a/src/Cobalt/Model/Documents.php +++ b/src/Cobalt/Model/Documents.php @@ -17,7 +17,6 @@ use Cobalt\Helper\DateHelper; use Joomla\Filesystem\File; use Joomla\Registry\Registry; -use JUri; // no direct access defined( '_CEXEC' ) or die( 'Restricted access' ); diff --git a/src/Cobalt/Model/Install.php b/src/Cobalt/Model/Install.php index ac633d1d..8c39f36c 100644 --- a/src/Cobalt/Model/Install.php +++ b/src/Cobalt/Model/Install.php @@ -450,7 +450,7 @@ public function __createDatabase($db, $options, $utf = true) { if (is_null($options)) { - throw new RuntimeException('$options object must not be null.'); + throw new \RuntimeException('$options object must not be null.'); } elseif (empty($options->db_name)) { diff --git a/src/Cobalt/Model/Revenue.php b/src/Cobalt/Model/Revenue.php index fcd68aaf..736eec61 100644 --- a/src/Cobalt/Model/Revenue.php +++ b/src/Cobalt/Model/Revenue.php @@ -130,12 +130,16 @@ public function getYearlyRevenue($access_type = null, $access_id = null) // Get stage id to filter deals by $won_stage_ids = DealHelper::getWonStages(); - $results = array(); + $data = new \stdClass; + $data->labels = array(); + $data->datasets = array(); foreach ($months as $month) { $start_date = $month['date']; $end_date = DateHelper::formatDBDate(date('Y-m-d 00:00:00', strtotime($start_date . ' + 1 months'))); + $weekDate = new \DateTime($start_date); + $data->labels[] = TextHelper::_('COBALT_MONTH') . ' ' . $weekDate->format('m'); $query->clear() ->select('d.modified, SUM(d.amount) AS y') @@ -173,9 +177,17 @@ public function getYearlyRevenue($access_type = null, $access_id = null) } $totals['y'] = (int) $totals['y']; - $results[] = $totals; + $results[] = $totals['y']; } - return $results; + $data->datasets[0] = new \stdClass; + $data->datasets[0]->data = $results; + $data->datasets[0]->label = ''; + $data->datasets[0]->fillColor = "rgba(151,187,205,0.5)"; + $data->datasets[0]->strokeColor = "rgba(151,187,205,0.8)"; + $data->datasets[0]->pointColor = "rgba(151,187,205,0.75)"; + $data->datasets[0]->pointStrokeColor = "rgba(151,187,205,1)"; + + return $data; } } diff --git a/src/Cobalt/View/Admindocuments/Html.php b/src/Cobalt/View/Admindocuments/Html.php index 1f7943ec..f77efd23 100644 --- a/src/Cobalt/View/Admindocuments/Html.php +++ b/src/Cobalt/View/Admindocuments/Html.php @@ -63,7 +63,7 @@ public function render() else { //buttons - $this->toolbar->add(array('view' => 'documents', 'layout' => 'edit', 'format' => 'raw', 'tmpl' => 'component', 'return' => base64_encode(\JUri::current())), 'COBALT_TOOLBAR_NEW', 'btn btn-primary', 'plus', array('data-toggle'=> 'modal', 'data-target'=> '#uploadModal')); + $this->toolbar->add(array('view' => 'documents', 'layout' => 'edit', 'format' => 'raw', 'tmpl' => 'component', 'return' => base64_encode($app->get('uri')->current())), 'COBALT_TOOLBAR_NEW', 'btn btn-primary', 'plus', array('data-toggle'=> 'modal', 'data-target'=> '#uploadModal')); // ToolbarHelper::editList('edit'); $this->toolbar->addDeleteRow(); diff --git a/src/Cobalt/View/Admindocuments/tmpl/default.php b/src/Cobalt/View/Admindocuments/tmpl/default.php index ec03ab9a..f91436f7 100644 --- a/src/Cobalt/View/Admindocuments/tmpl/default.php +++ b/src/Cobalt/View/Admindocuments/tmpl/default.php @@ -18,15 +18,15 @@
-
+
- + diff --git a/src/Cobalt/View/Admindocuments/tmpl/edit.php b/src/Cobalt/View/Admindocuments/tmpl/edit.php index 5f6674ee..08cb0f51 100644 --- a/src/Cobalt/View/Admindocuments/tmpl/edit.php +++ b/src/Cobalt/View/Admindocuments/tmpl/edit.php @@ -16,10 +16,10 @@

header; ?>

-
+ - +
@@ -28,7 +28,7 @@ - +
diff --git a/src/Cobalt/View/Admindocuments/tmpl/upload.php b/src/Cobalt/View/Admindocuments/tmpl/upload.php index 5584b8f2..3bf1e5d5 100644 --- a/src/Cobalt/View/Admindocuments/tmpl/upload.php +++ b/src/Cobalt/View/Admindocuments/tmpl/upload.php @@ -10,7 +10,7 @@ // no direct access defined( '_CEXEC' ) or die( 'Restricted access' ); ?> -
+
@@ -23,5 +23,5 @@ - + \ No newline at end of file diff --git a/src/Cobalt/View/Admindocuments/tmpl/upload_success.php b/src/Cobalt/View/Admindocuments/tmpl/upload_success.php index ea2c6d52..0c213de4 100644 --- a/src/Cobalt/View/Admindocuments/tmpl/upload_success.php +++ b/src/Cobalt/View/Admindocuments/tmpl/upload_success.php @@ -10,6 +10,6 @@ // no direct access defined( '_CEXEC' ) or die( 'Restricted access' ); ?> menu['menu']->render(); ?>
-

+

    -
  • +
-

+

    -
  • -
  • +
  • +
  • - +
  • - +
  • - +
  • @@ -66,21 +66,21 @@
-

+

    -
  • -
  • +
  • +
  • - + - + - +
  • @@ -91,21 +91,21 @@
    import_post==TRUE) { ?> -

    +

    import_data) && count($this->import_data) > 0 ) { ?> -

    +

    -

    +

    import_data) && count($this->import_data) > 1 ) { ?>
    - + 1 - + import_data); ?> - - - + - +
    @@ -126,7 +126,7 @@
    -
    +
    @@ -136,7 +136,7 @@
    - +
@@ -144,32 +144,32 @@

-

+

-

-

+

+

- + - +
- + - +
diff --git a/src/Cobalt/View/Adminimport/tmpl/sample.php b/src/Cobalt/View/Adminimport/tmpl/sample.php index d56bbd49..a2d8f115 100644 --- a/src/Cobalt/View/Adminimport/tmpl/sample.php +++ b/src/Cobalt/View/Adminimport/tmpl/sample.php @@ -21,25 +21,25 @@
-

-

+

+

- + - +
- + - +
diff --git a/src/Cobalt/View/Branding/tmpl/default.php b/src/Cobalt/View/Branding/tmpl/default.php index 04d038fc..f8e826e7 100644 --- a/src/Cobalt/View/Branding/tmpl/default.php +++ b/src/Cobalt/View/Branding/tmpl/default.php @@ -19,32 +19,32 @@
-

+

- - - - + + + + - - - - + + + + - - - - + + + +
-

+

site_logo) ) { ?> @@ -55,28 +55,28 @@
- - + +
-

+

-

+

-

+

@@ -86,26 +86,26 @@ - +
- + @@ -47,7 +47,7 @@ - + diff --git a/src/Cobalt/View/Categories/tmpl/edit.php b/src/Cobalt/View/Categories/tmpl/edit.php index d9b95c38..21d26e30 100644 --- a/src/Cobalt/View/Categories/tmpl/edit.php +++ b/src/Cobalt/View/Categories/tmpl/edit.php @@ -42,7 +42,7 @@ - + diff --git a/src/Cobalt/View/Cobalt/tmpl/default.php b/src/Cobalt/View/Cobalt/tmpl/default.php index dfe443dc..990aedaa 100644 --- a/src/Cobalt/View/Cobalt/tmpl/default.php +++ b/src/Cobalt/View/Cobalt/tmpl/default.php @@ -14,7 +14,7 @@
launch_default) { ?>
- setup_percent.'% '.JText::_('COBALT_COMPLETED'); ?> + setup_percent.'% '.JText::_('COBALT_COMPLETED'); ?>
@@ -36,7 +36,7 @@
php_version_check) { ?>
- php_version); ?> + php_version); ?>
@@ -45,30 +45,30 @@ - + installedVersion, $this->latestVersion, 'ge') ) { ?> - installedVersion); ?> + installedVersion); ?> - installedVersion, $this->latestVersion); ?> - + installedVersion, $this->latestVersion); ?> +

-

+

-
+
diff --git a/src/Cobalt/View/Cobalt/tmpl/help_menu.php b/src/Cobalt/View/Cobalt/tmpl/help_menu.php index a5580cc1..7e08fc34 100644 --- a/src/Cobalt/View/Cobalt/tmpl/help_menu.php +++ b/src/Cobalt/View/Cobalt/tmpl/help_menu.php @@ -12,7 +12,7 @@ help_type != "launch_default") { if (!$this->launch_default) { ?>
-

+