fix lot of errors, working dashboard

This commit is contained in:
osaajani 2019-11-14 22:33:00 +01:00
parent 27d2a6c5b2
commit 6d9b1289fd
27 changed files with 89 additions and 73 deletions

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Command($this->$bdd);
$this->model = $this->model ?? new \models\Command($this->bdd);
return $this->model;
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Contact($this->$bdd);
$this->model = $this->model ?? new \models\Contact($this->bdd);
return $this->model;
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Event($this->$bdd);
$this->model = $this->model ?? new \models\Event($this->bdd);
return $this->model;
}
@ -40,7 +40,7 @@ namespace controllers\internals;
*/
public function get_lasts_by_date_for_user (int $id_user, int $nb_entry)
{
return $this->get_lasts_by_date_for_user($id_user, $nb_entry);
return $this->get_model()->get_lasts_by_date_for_user($id_user, $nb_entry);
}
@ -59,6 +59,6 @@ namespace controllers\internals;
'text' => $text,
];
return $this->model_event->insert($event);
return $this->get_model()->insert($event);
}
}

View file

@ -24,7 +24,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Event($this->$bdd);
$this->model = $this->model ?? new \models\Event($this->bdd);
return $this->model;
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Phone($this->$bdd);
$this->model = $this->model ?? new \models\Phone($this->bdd);
return $this->model;
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Received($this->$bdd);
$this->model = $this->model ?? new \models\Received($this->bdd);
return $this->model;
}
@ -105,7 +105,15 @@ namespace controllers\internals;
*/
public function count_by_day_since_for_user(int $id_user, $date)
{
return $this->get_model()->count_by_day_since_for_user($id_user, $date);
$counts_by_day = $this->get_model()->count_by_day_since_for_user($id_user, $date);
$return = [];
foreach ($counts_by_day as $count_by_day)
{
$return[$count_by_day['at_ymd']] = $count_by_day['nb'];
}
return $return;
}
@ -122,8 +130,8 @@ namespace controllers\internals;
/**
* Get SMS received since a date for a user
* @param $date : La date depuis laquelle on veux les SMS (au format 2014-10-25 20:10:05)
* @param int $id_user : User id
* @param $date : La date depuis laquelle on veux les SMS (au format 2014-10-25 20:10:05)
* @return array : Tableau avec tous les SMS depuis la date
*/
public function get_since_by_date_for_user(int $id_user, $date)

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Scheduled($this->$bdd);
$this->model = $this->model ?? new \models\Scheduled($this->bdd);
return $this->model;
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\Sended($this->$bdd);
$this->model = $this->model ?? new \models\Sended($this->bdd);
return $this->model;
}
@ -126,6 +126,14 @@ namespace controllers\internals;
*/
public function count_by_day_since_for_user(int $id_user, $date)
{
return $this->get_model()->count_by_day_since_for_user($id_user, $date);
$counts_by_day = $this->get_model()->count_by_day_since_for_user($id_user, $date);
$return = [];
foreach ($counts_by_day as $count_by_day)
{
$return[$count_by_day['at_ymd']] = $count_by_day['nb'];
}
return $return;
}
}

View file

@ -21,7 +21,7 @@ namespace controllers\internals;
*/
protected function get_model () : \descartes\Model
{
$this->model = $this->model ?? new \models\SmsStop($this->$bdd);
$this->model = $this->model ?? new \models\SmsStop($this->bdd);
return $this->model;
}