/**
  * Init task
  *
  * @param int $id Article ID
  *
  * @since  1.0.0
  * @author Dennis Eichhorn <*****@*****.**>
  */
 public function init($id)
 {
     $this->id = $id;
     $data = null;
     $elements = null;
     switch ($this->dbPool->get('core')->getType()) {
         case \phpOMS\DataStorage\Database\DatabaseType::MYSQL:
             $sth = $this->dbPool->get('core')->con->prepare('SELECT
                         `' . $this->dbPool->get('core')->prefix . 'tasks`.*
                     FROM
                         `' . $this->dbPool->get('core')->prefix . 'tasks`
                    WHERE `' . $this->dbPool->get('core')->prefix . 'tasks`.`TaskID` = :id');
             $sth->bindValue(':id', $id, \PDO::PARAM_INT);
             $sth->execute();
             $data = $sth->fetchAll()[0];
             $sth = $this->dbPool->get('core')->con->prepare('SELECT
                         `' . $this->dbPool->get('core')->prefix . 'tasks_element`.*
                     FROM
                         `' . $this->dbPool->get('core')->prefix . 'tasks_element`
                    WHERE `' . $this->dbPool->get('core')->prefix . 'tasks_element`.`task` = :id');
             $sth->bindValue(':id', $id, \PDO::PARAM_INT);
             $sth->execute();
             $elements = $sth->fetchAll();
             break;
     }
     $this->title = $data['title'];
     $this->creator = $data['creator'];
     $this->created = new \DateTime($data['created']);
     $this->description = $data['desc'];
     $this->status = $data['status'];
     $this->due = new \DateTime($data['due']);
     $this->done = new \DateTime($data['done']);
     foreach ($elements as $element) {
         $elementOBJ = new TaskElement($this->dbPool);
         $elementOBJ->setID($element['TaskelementID']);
         $elementOBJ->setTask($element['task']);
         $elementOBJ->setStatus($element['status']);
         $elementOBJ->setCreated(new \DateTime($element['created']));
         $elementOBJ->setCreator($element['creator']);
         $elementOBJ->setDescription($element['desc']);
         $elementOBJ->setDue(new \DateTime($element['due']));
         $elementOBJ->setForwarded($element['forwarded']);
         $this->addElement($elementOBJ);
     }
 }
 /**
  * Get all staff members
  *
  * This function gets all accounts in a range
  *
  * @param array $filter Filter for search results
  * @param int   $offset Offset for first account
  * @param int   $limit  Limit for results
  *
  * @return array
  *
  * @since  1.0.0
  * @author Dennis Eichhorn <*****@*****.**>
  */
 public function getList($filter = null, $offset = 0, $limit = 100)
 {
     $result = null;
     switch ($this->dbPool->get('core')->getType()) {
         case \phpOMS\DataStorage\Database\DatabaseType::MYSQL:
             $search = $this->dbPool->get('core')->generate_sql_filter($filter, true);
             $sth = $this->dbPool->get('core')->con->prepare('SELECT
                         `' . $this->dbPool->get('core')->prefix . 'hr_staff`.*
                     FROM
                         `' . $this->dbPool->get('core')->prefix . 'hr_staff` ' . $search . 'LIMIT ' . $offset . ',' . $limit);
             $sth->execute();
             $result['list'] = $sth->fetchAll();
             $sth = $this->dbPool->get('core')->con->prepare('SELECT FOUND_ROWS();');
             $sth->execute();
             $result['count'] = $sth->fetchAll()[0][0];
             break;
     }
     return $result;
 }
 /**
  * Get all accounts
  *
  * This function gets all accounts in a range
  *
  * @param array $filter Filter for search results
  * @param int   $offset Offset for first account
  * @param int   $limit  Limit for results
  *
  * @return array
  *
  * @since  1.0.0
  * @author Dennis Eichhorn <*****@*****.**>
  */
 public function getList($filter = null, $offset = 0, $limit = 100)
 {
     $result = null;
     switch ($this->dbPool->get('core')->getType()) {
         case \phpOMS\DataStorage\Database\DatabaseType::MYSQL:
             $search = $this->dbPool->get('core')->generate_sql_filter($filter, true);
             $sth = $this->dbPool->get('core')->con->prepare('SELECT
                         `' . $this->dbPool->get('core')->prefix . 'tasks`.*, `' . $this->dbPool->get('core')->prefix . 'tasks_element`.`forwarded`
                     FROM
                         `' . $this->dbPool->get('core')->prefix . 'tasks`
                     LEFT JOIN `' . $this->dbPool->get('core')->prefix . 'tasks_element`
                     ON `' . $this->dbPool->get('core')->prefix . 'tasks`.`TaskID` = `' . $this->dbPool->get('core')->prefix . 'tasks_element`.`task`
                     AND `' . $this->dbPool->get('core')->prefix . 'tasks_element`.`forwarded` = 1
                     GROUP BY `' . $this->dbPool->get('core')->prefix . 'tasks`.`TaskID` ' . $search . 'LIMIT ' . $offset . ',' . $limit);
             $sth->execute();
             $result['list'] = $sth->fetchAll();
             $sth = $this->dbPool->get('core')->con->prepare('SELECT FOUND_ROWS();');
             $sth->execute();
             $result['count'] = $sth->fetchAll()[0][0];
             break;
     }
     return $result;
 }
 /**
  * Get all clients
  *
  * This function gets all accounts in a range
  *
  * @param array $filter Filter for search results
  * @param int   $offset Offset for first account
  * @param int   $limit  Limit for results
  *
  * @return array
  *
  * @since  1.0.0
  * @author Dennis Eichhorn <*****@*****.**>
  */
 public function getList($filter = null, $offset = 0, $limit = 100)
 {
     $result = null;
     switch ($this->dbPool->get('core')->getType()) {
         case \phpOMS\DataStorage\Database\DatabaseType::MYSQL:
             $search = $this->dbPool->get('core')->generate_sql_filter($filter, true);
             // SQL_CALC_FOUND_ROWS
             $sth = $this->dbPool->get('core')->con->prepare('SELECT DISTINCT
                         `' . $this->dbPool->get('core')->prefix . 'sales_client`.*,
                         `' . $this->dbPool->get('core')->prefix . 'accounts_data`.`name1`,
                         `' . $this->dbPool->get('core')->prefix . 'accounts_data`.`name2`,
                         `' . $this->dbPool->get('core')->prefix . 'accounts_data`.`name3`
                     FROM
                         `' . $this->dbPool->get('core')->prefix . 'sales_client`
                     LEFT JOIN `' . $this->dbPool->get('core')->prefix . 'accounts_data`
                     ON `' . $this->dbPool->get('core')->prefix . 'sales_client`.`account` = `' . $this->dbPool->get('core')->prefix . 'accounts_data`.`account`
                     GROUP BY `' . $this->dbPool->get('core')->prefix . 'sales_client`.`SalesClientID` ' . $search . 'LIMIT ' . $offset . ',' . $limit);
             $sth->execute();
             $result['list'] = $sth->fetchAll();
             $sth = $this->dbPool->get('core')->con->prepare('SELECT FOUND_ROWS();');
             $sth->execute();
             $result['count'] = $sth->fetchAll()[0][0];
             break;
     }
     return $result;
 }